Question 2
[10 marks]
Indicate whether the following statements are True or False in your answer booklet.
ID Statement/Description
1 The UNION set operator removes duplicates by default.
2 Views can be used to simplify complex queries.
3 SQL commands are case-sensitive.
4 Normalisation increases data redundancy.
5 A primary key can have NULL values.
6 Indexes can speed up data retrieval.
7 Constraints enforce rules at the table level.
8 A LEFTJOIN returns unmatched rows from the right table.
9 HAVING is used after GROUP BY to filter grouped data.
10 ROLLBACK undoes all changes since the last COMMIT.
True False
SECTION B: CONCEPTS
[Marks: 10]
1. Explain the difference between a candidate key, primary key, and foreign key. [3 Marks]
2. Explain the purpose and use of the GROUP BY clause in SQL using an example. [3 Marks]
3. Given the following tables Department(DepartmentlD, DepartmentName, Location ID) and
Employee(EmployeelD, EmployeeName, DepartmentlD). Write a SQL Command that will
retrieve EmployeelD, EmployeeName and DepartmentName.
[4 Marks]
SECTION C: COMPREHENSION
[Marks: 40]
1. Given the following scenario, create an appropriate ER diagram. Include at least 3
attributes and 1 primary Key for each entity. Include the cardinality and relationships. Use
Crow's Foot Notation.
[13 Marks]
A small community library wants you to design and develop a database system to manage
books, their members, and record borrowing records. Each member may or may not
borrow many books. Each Book can have one bookloan at a time to one member.
Page I 3