Assignements
description
Transcript of Assignements
Assignements
CSC343: Intro. to Databases 2
Exercise 1
• Superkeys:
• Candidate keys:
• Primary key:
RegNum Surname FirstName BirthDate DegreeProg284328 Smith Luigi 29/04/59 Computing296328 Smith John 29/04/59 Computing587614 Smith Lucy 01/05/61 Engineering934856 Black Lucy 01/05/61 Fine Art965536 Black Lucy 05/03/58 Fine Art
CSC343: Intro. to Databases 3
Exercise2
What is a foreign key constraint? Why are such constraints important? What is referential integrity?
CSC343: Intro. to Databases 4
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 5
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?
Consider the following ER diagram!!. List all superkeys , candidate keys, and primary keys 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 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.
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?
• 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.
Translate the following model into a relational model