Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assignements. CSC343: Intro. to Databases2 Exercise 1 Superkeys: Candidate keys: Primary key:

Similar presentations


Presentation on theme: "Assignements. CSC343: Intro. to Databases2 Exercise 1 Superkeys: Candidate keys: Primary key:"— Presentation transcript:

1 Assignements

2 CSC343: Intro. to Databases2 Exercise 1 Superkeys: Candidate keys: Primary key:

3 CSC343: Intro. to Databases3 Exercise2 What is a foreign key constraint? Why are such constraints important? What is referential integrity?

4 CSC343: Intro. to Databases4 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)

5 CSC343: Intro. to Databases5 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?

6 Consider the following ER diagram!!. List all superkeys, candidate keys, and primary keys for entities sets Students and Courses, and for relationship set Enrolled.

7 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

8 Hotel reservations Each hotel is designed by its name, address, city, price for each kind of room, and the number of rooms for each kind. Customers are identified by name, surname, address and tel number. They can book one or more rooms for one or more consecutive days. 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.

9 Hotel reservations We also want to store info about the actual stay of the hosts: the actual arrival and departure dates (that might be different from the ones specified during the reservation), the advance paid at the booking time, the balance ( amount of money still to be paid) and the status of the payment (paid/ to be paid). Draw UML diagram and translate it into relations?

10 Translate the following diagram into relations. Make the translation of the hierarchical structure between the Part entity sets in the three variants.

11 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.

12

13 Translate the following model into a relational model


Download ppt "Assignements. CSC343: Intro. to Databases2 Exercise 1 Superkeys: Candidate keys: Primary key:"

Similar presentations


Ads by Google