HIT234 Database Concepts Assignment
- Subject Code :
HIT234
Question1:ERDiagrams(25marksintotal)
ForeachofthebelowscenariosdrawaseparateE-RDiagramincludingattributes,cardinalitiesand identifiers when applicable.
- DarwinCom Pty Ltd is made up of a number of departments that manage none or more projects. Each project is made up of none or more team members. Each team member belongs to one departmentandzerotooneOneoftheteammemberssupervisestheotherteammembers on the project.
- A company hasfourEachdepartmenthasonemanager.Eachdepartmentemploys staff. Each staff may work for one or more departments. Staff may be supervised by another staff at least.
- Acarinsurancecompanywhosecustomersownoneormorecars each.Eachcarhasassociated with it zero to any number of recorded accidents.
- Universityregistrarhas thefollowingentities:Courses(includingcoursenumber,title,credits, syllabus, and prerequisites); Course offerings, (including course number, year, teaching period, instructors, timings and classroom); Students (including student-id, name, and program); and Instructors (including identification number, name, department, and title). The enrolment of students in courses and grades awarded to students in each course they are enrolled for must be appropriately modelled. An instructor could teach in only one course. Each course only runs in one session
- Employees(identifiedbyEMP-ID,SURNAME,FIRST-NAME,andDate-ofBirth)makemany orders (identified by ORDER-NO, ORDER-DATE, DES, WUOTED-PRICE) for Customers (Identified by CUST-ID). The orders are for one customer at a time but a customer might have many orders. The orders create many requests (Identified by REQUEST-NO, START-DATE, END-DATE). Those requests might result in few jobs (identified by JOB-NO, COST) and consequently will use different materials (identified by MATERIAL-ID, MATERIAL-DES). The requests are made to one section but a section has many requests.
Question2:Relationships
Considerthefollowing3NFrelationsaboutasororityorfraternity: MEMBER (Member_ID, Name, Address, Dues_Owed)
OFFICE (Office_Name, Officer_ID, Term_Start_Date, Budget) EXPENSE(Ledger_Number,Office_Name,Expense_Date,Amt_Owed) PAYMENT (Check_Number, Expense_Ledger_Number, Amt_Paid) RECEIPT (Member_ID, Receipt_Date, Dues_Received)
COMMITTEE(Committee_ID,Officer_in_Charge) WORKERS (Committee_ID, Member_ID) (15marksintotal)
- Show which attributesareforeignkeysandjustifyyour
- Draw an E-Rdiagramfortheserelations,usingyouranswerinpart
- Explaintheassumptionsyoumadeaboutcardinalitiesin youranswertopartExplainwhyitis said that the ER data model is more expressive or more semanticallyrich than the relational data model.
Question3:Normalization(25marksintotal)
- Assume that atDarwinFurnitureproductsarecomprisedofcomponents, productsare assigned to salespersons, and components are produced by vendors.Also assume that in the relation PRODUCT(Prodname,Salesperson,Compname,Vendor)Vendorisfunctionallydependenton Compname, and Compname is functionally dependent on Prodname.Eliminate the transitive dependency in this relation and form 3NF relations. (10 marks)
- The dependency diagram in the Figure below indicates that authors are paid royalties for each book that theywritefora publisher.Theamount ofthe royaltycanvarybyauthor, bybook, and by the edition of the book. (15 marks)
- Based on thedependencydiagram,createadatabasewhosetablesareatleastin2NF, showing the dependency diagram for each table.
- Create a database whose tables are atleast in 3NF, showing the dependency diagram foreach table.
Question4:SQLstatements (20marksintotal)
Thefollowingistherelationalschemaofpartofthedatabasethat HighTechPtyLtd recently implemented:
DEPARTMENT(DeptNo,Name,Location)
EMPLOYEE(EmpNo,Name,Street,City,Postcode,HireDate,Salary,DeptNo) LEAVE (EmpNo, FromDate, ToDate)
EMPQUAL(EmpNo,QualID)
QUALIFICATION(QualID,Qualification,Institution)
Usingtheaboveschema,writeSQLqueriesthatwillanswer/processthefollowing:
- List all citieswherean employeeOnlyshowthecityonce.
- What is thelowestsalarypaid foranyemployeethatlivesin thecityofDarwin?
- For each qualification,showthetotalnumberofemployeesthathavethatShow qualification id, qualification and the total number.
- List any employeeswhoareonannualleaveon01/05/2018.Note,dateformatis#01?05? 2018#. Show employee number only.
- What is thetotalsalarycostincurredbyHighTechforemployeesintheMarketingdepartment?
- List the employee(s)withthehighestShowemployeenumberandname.
- List the employeenames andallof theinstitutionsthattheyhavestudied
- How many employees haveno qualifications?
- Delete all leaverowsiftheleave endedpriortothestartofthis
- Increase the salaryof allemployeesby$80.
Question5:ViewsandGranting(15marksintotal)
UsingthetablesinAppendixA
- What are theadvantagesofusingVIEWinSQL?
- UsingstatementCreateaVIEWshowingthedetailsofallCustomerswhohavereturned an
FirstName |
LastName |
Suburb |
RegNo |
Make |
Year |
DateTaken |
Date Returned |
Mohamed |
Griffin |
Nightcliff |
BRG446 |
Ford |
2009 |
15/11/2011 |
|
Anna |
Thanh |
Coconut Grove |
NMT667 |
Madza |
2010 |
16/11/2011 |
|
Justin |
Brownworth |
Nakara |
CCT899 |
Toyota |
2009 |
17/11/2011 |
- CreateaqueryusingthenewviewtofindthecustomerinCoconutGroveor
FirstName |
LastName |
Suburb |
RegNo |
Make |
Year |
DateTaken |
Date Returned |
Anna |
Thanh |
Coconut Grove |
NMT667 |
Mazda |
2010 |
2/09/2011 |
3/09/2011 |
- AsanownerofthisviewGRANTpermissiontousers989232toenablehim/herfullaccess
Automobile
AppendixA
Reg No
Make |
Model |
Year |
Colour |
|
BRG446 |
Ford |
Meteor |
2009 |
White |
VRG655 |
Bmw |
Coupe |
2008 |
Blue |
NMT667 |
Madza |
DeliveryVan |
2010 |
Green |
CCT899 |
Toyota |
HiLuxe |
2009 |
Red |
FGR122 |
Mitsubishi |
Magna |
2007 |
Purple |
CustomerTable
Employee_No |
FirstName |
LastName |
Suburb |
A118 |
Mohamed |
Griffin |
Nightcliff |
A120 |
Ali |
McDonald |
Brinkin |
A123 |
Albert |
Underwood |
RapidCreek |
A134 |
Sammy |
Smith |
Casuarina |
A156 |
Anna |
Thanh |
CoconutGrove |
A166 |
Justin |
Brownworth |
Nakara |
CustomerAutomobileTable
Employee_veh |
Reg No |
Employee_No |
DateTaken |
DateReturned |
B-12 |
BRG446 |
A118 |
1/09/2011 |
3/09/2011 |
B-13 |
NMT667 |
A156 |
2/09/2011 |
3/09/2011 |
B-14 |
CCT899 |
A166 |
2/09/2011 |
4/09/2011 |
B-15 |
FGR122 |
A134 |
3/09/2011 |
5/09/2011 |
B-16 |
BRG446 |
A118 |
4/09/2011 |
10/09/2011 |
B-17 |
NMT667 |
A166 |
5/09/2011 |
10/09/2011 |
B-18 |
NMT667 |
A134 |
11/09/2011 |
15/09/2011 |
B-19 |
FGR122 |
A166 |
12/09/2011 |
15/11/2011 |
B-20 |
NMT667 |
A118 |
14/11/2011 |
15/11/2011 |
B-12 |
BRG446 |
A118 |
15/11/2011 |
|
B-13 |
NMT667 |
A156 |
16/11/2011 |
|
B-14 |
CCT899 |
A166 |
17/11/2011 |