0% found this document useful (0 votes)
9 views

BITHBSIT121 Assignment 2

Uploaded by

addiembengo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

BITHBSIT121 Assignment 2

Uploaded by

addiembengo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

BITH/BSIT 121 Database Design and Implementation

Assignment 2
Due 15 April 2024 @ 20:00 hours

Instructions
Answer all questions

1. Study the following relation.


Chckout Chckout Book Title Author Author Publisher Pub Return User User User
Number Date SBN Name Info Year Date Num Name Email

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

EmpI Name Position City Salary


D

040 Peter Manager Bulaway 50040


o

030 James Director Gweru 30000


0

034 Mary Technicia Gweru 20000


n

500 Suzan Manager Harare 34560


a

250 Garry Deputy Gweru 17000


Director 0

Departments Table

DepID DepartmentName EmpID

D20 HR 040

D30 Financ 034

D33 Administration 250

D20 Administration 500

D31 Support 030

(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 =================================

You might also like