140 likes | 280 Views
Assignements. Exercise 1. Superkeys : Candidate keys : Primary key :. Exercise2. What is a foreign key constraint? Why are such constraints important? What is referential integrity?. Exercise 3.
E N D
Exercise 1 • Superkeys: • Candidatekeys: • Primary key: CSC343: Intro. to Databases
Exercise2 What is a foreign key constraint? Why are such constraints important? What is referential integrity? CSC343: Intro. to Databases
Exercise 3 Answer each of the following questions briefly. The questions are based on the following relational schema: • Emp (eid: integer, ename: string, age: integer, salary: real) • Works (eid: integer, did: integer, pcttime: integer) • Dept (did: integer, dname: string, budget: real, managerid: integer) CSC343: Intro. to Databases
Exercise 3 • Give an example of a foreign key constraint that involves the Dept relation. • What are the options for enforcing this constraint when a user attempts to delete a Dept tuple? CSC343: Intro. to Databases
Consider the following ER diagram!!. List all superkeys , candidatekeys, and primarykeys for entities sets Students and Courses, and for relationship set Enrolled.
Assignement 2 • Draw UML class diagrams for a car rental agency database , keeping track of current rental location of each car, its current condition and history of repairs, and customer information for a local office, expected return date, return location, car status (ready, being-repaired, currently rented, being-cleaned). • Select attributes from your intuition about the situation. Draw one diagram showing the relationships of the classes without the attributes listed. • Translate the diagram into relations
Hotel reservations • Each hotel is designed by itsname , address , city, price for each kind of room , and the number of rooms for each kind. • Customers areidentified by name , surname, address and telnumber. They can book one or more rooms for one or more consecutivedays. For each reservation, it is necessary to store the name of the customer, the date of the resrvation as well as the arrival date and departure date.
Hotel reservations • Wealsowant to store info about the actualstay of the hosts: the actual arrival and departure dates (thatmightbedifferent from the onesspecifiedduring the reservation), the advancepaid at the booking time, the balance ( amount of money still to bepaid) and the status of the payment (paid/ to bepaid). Draw UML diagram and translate it into relations?
Translate the following diagram into relations. Make the translation of the hierarchical structure between the Part entity sets in the three variants.
Web store The UML diagram below describes a web store, which sells DVD’s and CD’s (“items”) to customers. Items may belong to several categories. Customers may write reviews of the items that they have purchased. Translate the model into a relational model.