Question 1 Cutting Edge Incorporated is a company engaged in the development of computer-aided design (CAD) software packages. The management of Cutting Edge wants to develop a project tracking system to accumulate and report data on current projects, employees and departments. System analyst Suriyati Ahmad developed the following initial record design: (ProjectNumber, ProjectName, StartDate, ProjectStatus, (EmployeeNumber, EmployeeName, DepartmentNumber, DepartmentName, JobTitle, ProjectHours)) Suriyati believes the only system entities are Project, Department and Employee; but because she is assigned to two other projects, she had no time to consider the relationships among those system entities or to normalize the record design. a) For each of the three entities, identify the likely primary key. (3 marks) Answer: Project – ProjectNuimber Department – DepartmentNumber Employee - EmployeeNumber b) Draw an initial entity-relationship diagram for the system, using the entities Suriyati identified. State any assumptions you must make about the Cutting Edge organization to determine the types of the relationships. (6 marks) Answer: Have PROJECT DEPARTMENT Works Handle EMPLOYEE c) Convert the record design to third normal form. (11 marks) Answer: 1NF Project (ProjectNumber, ProjectName, StartDate, ProjectStatus) Employee (EmployeeNumber, DepartmentName, JobTitle, ProjectHours) EmployeeName, DepartmentNumber, 2NF ProjectStatus(ProjectNumber, EmployeeNumber, StartDate, ProjectStatus) Project (ProjectNumber, ProjectName) Employee (EmployeeNumber, DepartmentName, JobTitle, ProjectHours) EmployeeName, DepartmentNumber, 3NF Department ( DepartmentNumber, DepartmentName) DepartmentProject(DepartmentNumber, ProjectNumber) Employee ( EmployeeNumber, EmployeeName, JobTitle, ProjectHours) d) Draw a final entity-relationship diagram for the system. (10 marks) Answer: PROJECT PROJECTSTATUS PROJECTDEPT DEPARTMENT EMPLOYEE Question 2 Do a normalization from First Normal Form (1NF) until Third Normal Form (3NF) and state the rules for the normalization based on the given CustomerOrder relation. Then draw a complete Entity-Relationship diagram based on the normalized relation. CUSTOMERORDER (CustNo, CustName, OrderNo, ProdNo, ProdDesc, Qty, CustAddress, DateOrdered) Assumption: A customer can have multiple orders but an order can be for only 1 product. (20 marks) Answer: 1NF - remove multivalued dependencies (1 mark) CUSTOMER (CustNo, CustName, CustAddress) (1 mark) ORDER (CustNo, OrderNo, ProdNo, ProdDesc, Qty, DateOrdered) (1 mark) 2NF - remove partial dependencies (1 mark) CUSTOMER (CustNo, CustName, CustAddress) (1 mark) CUSTOMER ORDER (CustNo, OrderNo) (1 mark) ORDER (OrderNo, ProdNo, ProdDesc, Qty, DateOrdered) (1 mark) 3NF - remove transitive dependencies (1 mark) CUSTOMER (CustNo, CustName, CustAddress) (1 mark) CUSTOMER ORDER (CustNo, OrderNo) (1 mark) ORDER (OrderNo, ProdNo, Qty, DateOrdered) (1 mark) PRODUCT (ProdNo, ProdDesc) (1 mark) Customer make 1 m CustomerOrder m list 1 Order m has 1 Product (entities = 4 marks, relationship = 3 marks, any 1 cardinality = 1 mark) Question 3 a) Write SQL statements based on the following Employee schema relation: Employee (EmployeeNo, EmployeeName, EmployeeIC, Address, Sex, HandphoneNo, Email, Salary, Position, Skill, BranchNo) i) Identify the foreign key and candidate key in the relation. (2 marks) Answer: Foreign key = BranchNo Candidate key = EmployeeIC ii) List all employee who stay in Selangor and works in branch B003. (3 marks) Answer: SELECT * FROM Staff WHERE Address = “%Selangor%” AND BranchNo = “B003”; iii) List all staff with a salary below 20,000 or above 30,000. (3 marks) Answer: SELECT * FROM Staff WHERE salary NOT BETWEEN 20000 AND 30000; b) Draw ERD for the following scenario: “Employee works at a branch. There must be at least 20 employees for each branch. The branch is managed by a manager. The employee may handle a project or given an administrative task.” (12 marks) Answer: (entities= 4 marks, relationship = 4 marks, cardinalities=4 marks) Employee 1 Project manage work 1 1..1 Branch 1 handle 0..* 1 1..20 handle 0..* Admin Task Question 4 Sailors (sid, sname, rating, age); Boats (bid, bname, colour); Reserves (sid, bid, day); Answer the question below based on the above schema. a) Create table Sailors. Create table Sailors ( sid int Primary key, sname varchar(50), rating int, age int ); (2 marks) b) Find all sailors who are teens (age from 13 to 19) Select * From sailors Where age >= 13 and age <= 19 (2 marks) c) Find the names of sailors who have reserved at least two boats Select distinct s.sname From sailors s, reserves r1, reserves r2 Where s.sid = r1.sid and r1.sid = r2.sid and r1.bid <> r2.bid (4 marks) d) How many boats that has green colour? Select count(bid) From boats Where colour =’green’ (2 marks) Question 5 Do normalization from First Normal Form (1NF) until Third Normal Form (3NF) and state the rules for the normalization based on the given CompanyRequest relation. COMPANYREQUEST (CompNo, CompName, ReqNo, ProdNo, ProdDesc, Qty, CompAddress, DateRequested) Assumption: A company can have multiple requests but a request can be for only 1 product. (10 marks) Answer: 1NF - remove multivalued dependencies COMPANY (CompNo, CompName, CompAddress) (1 mark) REQUEST (CompNo, ReqNo, ProdNo, ProdDesc, Qty, DateRequested) (1 mark) 2NF - remove partial dependencies COMPANY (CompNo, CompName, CompAddress) (1 mark) COMPANYREQUEST(CompNo, ReqNo) (1 mark) REQUEST (ReqNo, ProdNo, ProdDesc, Qty, DateRequested) (1 mark) 3NF - remove transitive dependencies COMPANY (CompNo, CompName, CompAddress) (1 mark) COMPANY REQUEST (CompNo, ReqNo) (1 mark) REQUEST (RequestNo, ProdNo, Qty, DateRequested) (1 mark) PRODUCT (ProdNo, ProdDesc) (1 mark) Mark for correct sequence is 1m.