Professional Documents
Culture Documents
MST20222023 Sem 2
MST20222023 Sem 2
SINGAPORE POLYTECHNIC
Instruction to Candidates
/S2 Page 1
Restricted, Non-Sensitive
/S2 Page 2
Restricted, Non-Sensitive
1. The following relations show some members’ details, facilities description and rentals of
facilities by members in Jessie Country Club (JCC).
Member
MemberID Name Status Gender
A12345 Alexis Soh Wee Beng Ord M
A78655 Catherine Seah Ai Ord F
P21090 John Pereira Pri M
P34672 Sally Wee Pri F
P10989 John Pereira Ord M
P98981 Jenny Chua NULL F
Facility
FacilityID Description
E7865 Barbeque Pit
R1234 Karaoke Room
S6751 Badminton Court
S9879 Tennis Court
Rental
MemberID FacilityID Rental Date TimeStart TimeEnd
A12345 R1234 40.50 10/12/2022 1100 1300
A12345 R1234 40.50 11/7/2022 1100 1300
A78655 E7865 60.00 10/12/2022 1900 2200
P21090 E7865 50.00 7/6/2022 1900 2200
P34672 S6751 20.50 12/10/2022 1200 1300
A12345 R1234 40.50 10/12/2022 1500 1800
Note: Assume all columns can accept NULL except those columns that belong to the
Primary key
(a) Suggest an appropriate Primary Key for the Rental relation. (4 marks)
(b) The foreign keys and their referenced relations in Rental are indicated as follows.
Indicate with the help of line number, which statement is not permissible and state the
reason and the rule violated in the table provided. (2 marks)
/S2 Page 3
Restricted, Non-Sensitive
(c) Based on line numbers 4 and 5 from 1(b), indicate if the following statements is True
or False.
iii) If a particular FacilityID is deleted, the corresponding foreign key is not deleted.
(1 mark)
(d) The following rows are to be added into the Rental relation.
Indicate True or False in the following table and the reason if your choice is False.
(e) The following attribute(s) is/are chosen as Candidate Keys(CK) and Primary Key (PK)
for Member relation. Indicate if the choices are valid and the reason if your choice is
No.
/S2 Page 4
Restricted, Non-Sensitive
2. A collection of landed property leases is shown below. Assuming that a client rents a given
property only once and cannot rent more than one property at any one time. Rent is
computed on a monthly basis.
ClientRental
ClientNo CName PropNo Paddress RentStart RentFinish Rent OwnerNo OName
(a) Express the above table in 1NF in relational heading format. Underline the Primary
Key (2 marks)
(c) List all the functional dependencies from the 1NF relation. (6 marks)
(d) Convert the table in 1NF into 2NF in relational heading format. Underline all Primary
Keys. (3 marks)
(e) List all the transitive dependencies from the 2NF relations (2 marks)
(f) Convert the tables in 2NF into 3NF in relational heading format. Underline all Primary
Keys with bold lines and all Foreign Keys with dotted lines. (6 marks)
/S2 Page 5
Restricted, Non-Sensitive
Customers Order_Items
Customer_ID Name Points_earned Order_Number Item_ID Quantity
101 Jeffery 300 1 A001 1
102 Gabriel 50 2 A001 3
103 Bryan 50 2 S001 4
104 Richie 600 2 S002 2
105 Elvis 200 3 S003 4
106 Jonas 500 4 S005 1
107 Justin NULL 5 S004 5
108 Zaki NULL 6 S002 5
109 Uwan NULL 6 T001 1
7 A001 2
Orders
Order_Number Order_Date Customer_ID
1 2019-02-01 101
2 2019-04-15 101
3 2019-02-01 105
4 2019-04-24 104
5 2019-05-10 104
6 2019-05-10 105
7 2019-10-15 106
(a) Assuming the Customers, Items and Orders tables are created, write an SQL statement
to create the Order_Items table specifying all the primary keys and foreign keys.
Ignore referential actions. (5 marks)
/S2 Page 6
Restricted, Non-Sensitive
(b) Write an SQL statement to list the Customer’s ID and their points earned. Those
customers with unknown points earned should be indicated with ‘No points earned’.
The following is the expected output of the query. (7 marks)
(c) Write an SQL statement to list the orders and their respective total cost ordered. The
following is the expected output of the query. (8 marks)
(d) Write an SQL statement to list items that do not contain ‘Pen’ ordered by the item
description in an ascending order. The following is the expected output of the query.
(5 marks)
/S2 Page 7
Restricted, Non-Sensitive
4. TookTock is a social network company that develops their products for mass
adoption. They are setting up a database to manage their human resource and
property access system. They will be using the following business rules.
Draw a single Entity Relationship Diagram (ERD) to model the data requirements for the
TookTock database. You must adhere to the following requirements:
• Your entities in the ERD should include the primary keys and its attributes.
You must underline these primary keys. Composite primary keys are allowed.
The complete Primary Key will have to be shown in the diagram for weak entity types.
• Attributes for subtypes are required to be shown
• You must draw (in crow-foot notation) the cardinalities and participation
constraints of the relationships.
• If there are any, you should resolve M:N relations.
(30 marks)
---End of Paper---
/S2 Page 8