Advanced Database Technologies (IT5020) Assignment 1- Relational Model Faculty of Graduate Studies and Research Sri Lanka institute of Information Technology Course : MSc (IT) — Advanced Database Technologies Instructor : Prasanna S. Haddela Batch : 2020 June Name :Isuru prabath Subasinghe Email : Prabath230@gmail.com Contact Number : 071-6863995 Exercise 1 – Conceptual Modeling. Exercise 1 – Conceptual Modeling 1. Recommend at least 5 improvements, I. II. III. IV. V. Entities should be kept in singular. Adding cardinality ratio. Mentioning derived, multivalued, composite attributes clearly. Mapping week entity Generalization should be mentioned. 2. design traps Chasm trap between– author – book - published book 3. different ways of modelling same scenario. I. II. We can use different Generalization method like Superclass subclass method.[1] Category or Union Exercise 2 – Mapping from E-ER to Relational Model Author author_Id Items f-name item_numb l-name title other description Books item_numb Book_ID author_Id Text Book Book_ID Textbook_ID Semester Published Books Book_ID pubbook_ID edition Published Book Type pubbook_ID ISBN edition Year Section cover Year publishe publis Periodicals item_numb Periodicals_ID publisher frequenc Periodical Type Periodical Type_ID Periodicals_ID date Periodical Type News Paper Periodicals_ID Newspaper_name NewspaperID Magazine Periodicals_ID Magazine_name MagID Software & Manuals SoftMan_ID item_numb manufacture manufacture Members library_id f-name l-name other_name remarks password e-mail phone Members workpalce library_id office_no floor campus Members address library_id Address_L1 Address_L2 Address_L3 Member Type library_id Type Loan library_id Payment payId LoadID fine paid Date returne amount Date library_id C_itemID Date library_id item_numb manufacture Textbook_ID Semester Due date datetime_ borrowed fine C_itemID SoftMan_ID Copy of Item payId LoadID C-Software & Manual C_SoftMan_ID manufacture SoftMan_ID C-Text C_Book_ID Year Section C_itemID Textbook_ID C-Published Book Type C_pubbook_ID ISBN edition cover Year publishe publis C_itemID ISBN C-Periodical Type C_Periodical Type Periodicals_ID publisher frequenc C_itemID Periodical Type_ID Exercise 3 – SQL - SELECT Consider the following relational schema. An employee can work in more than one department; the pct-time field of the Works relation shows the percentage of time that a given employee works in a given department. Emp( eid: integer, ename: string, age: integer, salary: real) Works( eid: integer, did: string, pct-time: integer) Dept( did: string, budget: real, managerid: integer) Write the following queries in SQL: 1. Print the names and ages of each employee who works in both the Hardware department and the Software department. SELECT e.ename, e.age FROM Emp e INNER JOIN works w ON e.eid = w.eid INNER JOIN Dept d ON w.eid = d.did 2. Print the name of each employee whose salary exceeds the budget of all of the departments that he or she works in. SELECT E.ename FROM Emp E WHERE E.salary > ALL (SELECT D.budget FROM Dept D, Works W WHERE E.eid = W.eid AND D.did = W.did) 3. Find the managerids of managers who manage only departments with budgets greater than $1,000,000. SELECT distinct d. managerid FROM dept d Where 1000000<ALL ( SELECT d2.budget FROM dept d2 WHERE d2.managerid= d. managerid) 4. Find the enames of managers who manage the departments with the largest budget. SELECT E.ename FROM Emp E WHERE E.eid IN (SELECT D.managerid FROM Dept D WHERE D.budget >= ALL (SELECT D2.budget FROM Dept D2)) 5. If a manager manages more than one department, he or she controls the sum of all the budgets for those departments. Find the managerid of managers who control more than $5,000,000. SELECT M. managerid FROM Emp M WHERE M.sid IN (SELECT M2.sid FROM Emp M2, Dept D WHERE M2.sid = D.managerid AND D.budget < 5000000 EXCEPT SELECT M3.sid FROM Emp M3, Dept D2 WHERE M3.sid = D2.managerid AND D2.budget <= 5000000) 6. Find the managerid of managers who control the largest amount. SELECT distinct d. managerid FROM dept d Where 5000000<ALL (SELECT d2.budget FROM dept d2 WHERE d2.managerid= d. managerid) Resources [1] “Enhanced Entity Relationship Model (EER Model).” https://www.tutorialride.com/dbms/enhancedentity-relationship-model-eer-model.htm (accessed Feb. 20, 2021).