Uploaded by Grace Tebogo Mogotsi

Internal Assessment 1 2023

advertisement
Faculty
Faculty of Engineering and Technology
Assessment Name
Ex: Mid/End/Sup
Internal
Paper Code
CQMD/G23-1
Module Name
Querying and
Managing
Databases
Module Code
C6-QMD-11
Month
February
Year
2023
Total Marks
80
Duration
5 days
Instructions
QP-ASM-00|Rev 003
1. You are to answer all questions
Page 1 of 4
QUESTION 1
[5 marks]
An institute facilitates its students to participate in three types of sports events: Long Jump, Discus Throw
and 100-Meter race. The following attributes are recorded for each event:
Long Jump: Student Roll Number, Name, House, Age, Recorded Jump
Discus Throw: Student Roll Number, Name, House, Age, Distance covered
100 m. Race: Student Roll Number, Name, House, Age, Time taken
Apply rule of generalization and develop an EER model. You are to explain the different notations
QUESTION 2
Task – I:
[10 marks]
Map the following Entity Relationship Diagram to appropriate relations, and construct the structure of the
tables. Indicate the constraints thus Primary Key and foreign key.
QP-ASM-00|Rev 003
Task – II:
[5 marks]
You are to map data in Table 4-9 below to 3rd Normal Form. Assume that the primary key of this relation consists
of two components: Author’s ID (AID) and Book number (BNbr). The relation includes data regarding authors,
books, and publishers. In addition, it tells what an individual author’s per book royalty amount is in the case of
multi-authored books.
Page 2 of 4
Task – III:
1. Create database Mohakare_holding
2. Write the statement to ensure that the correct database is used.
3. Create table Department
Department
Column Name
Datatype
Constraint
Department_id
Varchar(5)
Primary Key
Department_name
Varchar(25)
Location
Varchar(25)
The location should be ‘Maseru’,
‘Mafeteng’, ’Qachas’Nek’
4. Create table Employee
QP-ASM-00|Rev 003
[02 marks]
[02 marks]
[05 marks]
[03 Marks]
Column Name
Datatype
Constraint
Emp_Id
Varchar(5)
Primary Key, should not allow empty values
Employee_Name
Varchar(25)
Department_id
Varchar(25)
Supervisor_Id
Varchar(5)
Foreign key – should refer the primary key of
department table
Task – III:
5. Add a new column salary in the employee tableof type money with should have a constraint of
ensuring that the minimum salary is more than 5000.
[04 Marks]
Page 3 of 4
6. Insert the values in the department table with the following data: (You are to only insert the record
for department D1001)
[01 Marks]
Department
Department_id
Department_name
Location
D1001
Accounting
Maseru
D1002
Technical
Mafeteng
D1003
Project Development
Qachas’Nek
Accounting
Mafeteng
D1004
7. Insert the values in the employee table with the following data: (Demonstrate your ability by only
inserting one line)
[03 Marks]
8. Update
the employee name ‘Tino’ to ‘Tinodiwanashe’
[04 Marks]
Employee
Empid
Employee_Name
Department_id
Supervisor_Id
Salary
E1001
Runako
D1001
E1003
5000
E1003
Tino
E1002
Rufadzo
D1003
D1002
E1002
NULL
7500
10000
Write the SQL statement of the following:
[02 Marks]
10. Display the names of all employees whose salary is above 5000
[02 Marks]
11. Display Department_name and their Location
[02 Marks]
QP-ASM-00|Rev 003
9. Display the employee names and their salaries
Page 4 of 4
Download