Introduction To Databases Test
Introduction To Databases Test
INTRODUCTION-TO-DATABASES-CT042-3-1-IDB Practice
Mock All Chapters 1-12
Introduction To Databases (Asia Pacific University of Technology and Innovation)
2. In the System Development Life Cycle (SDLC), problems defined during the planning
phase are examined in greater detail during the analysis phase.
Answer: True/FALSE
3. Foreign key is
a. A field in the table that is foreign key in another table.
b. A field in the table that is primary key in another table.
c. A field in the table that is record key in another table.
d. A field in the table that is column key in another table
a. i, ii
b. i, ii, iii
c. i, iii
d. ii, iii
c. DCL
d. CML
8. Data normalisation is enforced by the DBMS through a proper use of primary and
foreign key rules.
Answer: True/ False
9.
Which characteristic points to the tables shown above being in third normal form
(3NF)
a. The tables are completely free of data redundancy
b. The attributes are all single valued
c. “ClientID” appears in more than one table.
d. Each primary key has a functional dependency on every other primary key in
the table
12.
Table: salesman
a. Write a SQL statement that displays all the information about all salespeople. (2
marks)
13.
Table: Order
a. From the following table, write a SQL query to identify the unique salespeople ID.
Return salesman_id. (3 marks)
b. From the following table, write a SQL query to find orders that are delivered by a
salesperson with ID. 5001. Return ord_no, ord_date, purch_amt. (3 marks)
14. Based on case study below, draw a complete Entity Relationship Diagram (ERD).
You can choose either Chen or Crow Foot Notation. (15 marks)
15.
Based on the relations above, write structured query language (SQL) for the queries
given below. (12 marks)
a. List all male staff who earn below 4000 from ‘Marketing’ department (3
marks)
b. Add new department named Sales (D04), phone extension is 5014. (3 marks)
c. Staff named Ricky has changed address from Johor Bharu to Sri Petaling,
make necessary changes. (3 marks)
d. Staff named Eugene had resigned from the company, delete his record (3
marks)
Answer:
UNF
OrderN Unit Price Quantity Amount TotalAmo Cust_ ClerkI
um Description (RM) (pcs) (RM) unt ID CustName Address SO Date D ClerkName
Fairy Tales FutureKids Bukit Jalil, Kuala 25/10/2 Martin
B01 Stories 45 3 135 208 C005 Kindergarten Lumpur A112 023 003 Lawrence
FutureKids Bukit Jalil, Kuala 26/10/2 Martin
B06 The Mermaid 28 1 28 208 C005 Kindergarten Lumpur A113 023 003 Lawrence
The Red Riding FutureKids Bukit Jalil, Kuala 27/10/2 Martin
B12 Hood 15 3 45 208 C005 Kindergarten Lumpur A114 023 003 Lawrence
1NF
Primary Key: SO + OrderNum
Full Dependencies:
SO,ORderNumber -> Quantity, Amount
Partial Dependencies:
SO -> TotalAmount,Cust_ID,CustName,Address,Date,ClerkID,ClerkName
OrderNumber -> Description, unitPrice
Transitive Dependencies:
Cust_ID -> CustName, Address
ClerkID -> ClerkName
2NF
Transitive Dependencies:
Cust_ID -> CustName, Address
ClerkID -> ClerkName
3NF
SALES_ORDER_ITEM (SO,ORderNumber -> Quantity, Amount)
You may choose to use Chen Notation or Crow Foot Notation (20 marks)