BITHBSIT121 Assignment 2
BITHBSIT121 Assignment 2
Assignment 2
Due 15 April 2024 @ 20:00 hours
Instructions
Answer all questions
Ch001 23/01/2024 012456 Database Zvirikuzhe Lecturer Book 2024 13/04/202 N001 Marata [email protected]
Design Press 4
Ch002 24/02/2023 934566 Visual Mutero Senior Silicon 2023 17/03/202 N001 Marata [email protected]
Program Lecturer Press 4
333245 MYSQL Abisai Book 2011 20/09/201 N001 Marata [email protected]
Press 9
Ch003 15/01/2022 324444 DSS Garikai Secondary Palm 2021 13/05/202 N005 Dube [email protected]
School Publishers 3
Teacher
Ch004 21/07/2020 356789 Computer Nharo Book Arafate 2022 16/10/202 N006 Mabge [email protected]
Prog Editor Publishers 3
Ch006 02/06/2024 213141 Software Ndlovu Co-Author Digital 2016 14/06/202 N009 Tumbudzi [email protected]
engines Publishers 0
(a) Outline two reasons why the relation is not in 3NF. [2 Marks]
(b) Explain any two anomalies that could be encountered when carrying out transactions on
the relation above [4 Marks]
(c) Normalize the relation above to 3NF showing all the stages. [14 Marks]
2. Answer the following questions using SQL. You may use WAMP, XAMPP or MySQL
Workbench to attempt to the questions. For every attempted question, show the runtime
interface and the code (SQL statements).
(a) Create a database called company. [1 mark]
(b) Create and populate the two relations shown below. Show the primary key field for each
relation. [14 Marks]
1
Employees Table
Departments Table
D20 HR 040
(c) Design a query that retrieves employee name, position and salary for all employees who
earn between 10000 and 100000 and live in either Gweru or Bulawayo. [5 Marks]
(d) Develop a query that calculates the sum, average, minimum and maximum salary for all
employees whose position is manager or City name starts with a “G”. [5 Marks]
(e) Design a query that outputs the employee’s name, position and department name for all
employees whose city of residence is Gweru or they are in the company’s administration.
[5 Marks]
2
========================Total: 50 Marks =================================