0% found this document useful (0 votes)
4 views3 pages

G8 - Managing Data - L03 - Worksheet 6 (Answers)

The document is a worksheet for building a database with linked tables, focusing on a shop's products and a basketball team's player statistics. It includes tasks for creating tables with primary and foreign keys, detailing purchases and match schedules. The document emphasizes best practices in database design and requires the creation of multiple data tables with specified fields.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

G8 - Managing Data - L03 - Worksheet 6 (Answers)

The document is a worksheet for building a database with linked tables, focusing on a shop's products and a basketball team's player statistics. It includes tasks for creating tables with primary and foreign keys, detailing purchases and match schedules. The document emphasizes best practices in database design and requires the creation of multiple data tables with specified fields.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Name: ___________________________________________________________________ Class:___________

Worksheet 6 – Building a database with linked


tables

Questions

1) A shop sells these items:

Tablename: Products
Name Price (VND) Category ProductID
Rice Cooker 500,000 Kitchen 1
Electric Kettle 300,000 Kitchen 2
Fan 700,000 Appliances 3
Vacuum Cleaner 1,200,000 Appliances 4
Toaster 250,000 Kitchen 5
Blender 600,000 Kitchen 6
Chopsticks 30,000 Kitchen 7
Washing Machine 8,500,000 Appliances 8

(a) Add a primary key to the Products data table above. [1]
See table above. Any sensible name for the primary key is acceptable.

(b) The shop had three customers. This is what they purchased (bought):
 1st February 2024, a fan and a toaster were purchased.
 3rd February 2024, a washing machine was purchased.
 4th February 2024, an electric kettle, a rice cooker and chopsticks were purchased.

Create a data table below, called Purchases, that has the information about what the customers purchased.

You should follow 'best practice' and make sure the Purchases table has a primary key.

Tablename: Purchases
Purchase Number Date ProductID Purchase ID
1 01/02/2024 3 1
1 01/02/2024 5 2
2 03/02/2024 8 3
3 04/02/2024 2 4
3 04/02/2024 1 5
3 04/02/2024 7 6

[3]

(c) Which field in the Purchases table is the primary key?

Purchase ID [1]
Your answer should match what you used in the table in part (b)

(d) Which field in the Purchases table is the foreign key?

ProductID [1]
Your answer should match what you used in the table in part (b)
Name: ___________________________________________________________________ Class:___________
Name: ___________________________________________________________________ Class:___________

2) Read the information below about a basketball team.

Tablename: Players
PlayerID Name Age JoinDate
1 An Nguyen 13 01/09/2023
2 Bao Tran 14 10/09/2023
3 Chi Le 14 15/09/2023
4 Danh Pham 13 20/09/2023
5 Minh Do 14 25/09/2023
6 Lan Pham 14 01/10/2023

(a) The basketball team has played against three other teams so far:
 1st July 2024, against a team called Tigers
 8th July 2024, against a team called Eagles
 15th July 2024, against a team called Sharks

Create a data table below, called MatchSchedule, that has the information about the basketball matches.
Make sure your table has a primary key.

Tablename: MatchSchedule
GameID OpponentName GameDate
1 Tigers 01/07/2024
2 Eagles 08/07/2024
3 Sharks 15/07/2024
(1 mark for each column that is correct) [3]

(b) Data from the basketball games were as follows:


 In the game against Tigers, An Nguyen played in position of "Power Forward" and scored 12 points.
 In the game against Tigers, PlayerID = 6 had the position of "Substitude" and scored 3 points.
 In the game against Tigers, 10 points were scored by Chi Le, whose role was "Center".
 In the game against Eagles, Bao Tran played as the "Power Forward" and scored 15 points.
 In the game against Eagles, the player with PlayerID = 3 was the "Center", and scored 7 points.
 In the game against Sharks, Lan Pham had the role "Small Forward" and got 9 points.

Create a data table below, called GameInfo, that has the information about the players, what position (role)
they played and the number of points they scored. Make sure your table has a primary key.

Tablename: GameInfo
InfoID GameID PlayerID Role PointsScored
1 1 1 Power Forward 12
2 1 6 Substitute 3
3 1 3 Center 10
4 2 2 Power Forward 15
5 2 3 Center 7
6 3 6 Small Forward 9

Your table should:


 Have a primary key.
 Have two foreign keys: the primary key from the Players table, and the primary key from the
MatchSchedule table.
 Have sensible names for all the fields.
(1 mark for each column that is correct) [5]

You might also like