You are on page 1of 3

NAME: ___________________________ SECTION: ___________ GRADE:_____ ASSIGNMENT #1 ERD/ RELATIONAL MODEL General Instruction: Print or photocopy the whole

document and write your answers on the succeeding pages. Use short bond paper only. (HANDWRITTEN) Due on: 6/24/10. You can do it by group but please do not just copy the work of your classmates. Try to understand the real concept behind it. NO GUTS, NO GLORY. Exercise 1 Consider the following information about a university database: Each student has an id (sid), a name (sname), a major study direction (major) and an age (age). Each course has a name (cname), a time at which the course takes place (meets_at) and a room in which the course takes place (room). Each faculty has an id (fid) and a name (fname). Students can be enrolled in several courses and for each course there exists at least one student who is enrolled in that course. Each course belongs to one faculty and for each faculty exists at least one course which belongs to this faculty. Draw an ER diagram which captures the information above. Be sure to indicate every key and participation constraint. Exercise 2 Transform the ER diagram from exercise 1 into the relational model. Indicate the key attributes of each relation and add appropriate domain sets(e.g. For attribute age it should be positive integer not greater than 100) to each attribute of a relation. Exercise 3 Consider the relational schema from exercise 2. Give the relational algebra expressions. 1. Find the names of the students who study computer science (major=cs). 2. Find the sid of all students who are enrolled in at least one course and study computer science (major=cs) or are older than 28. 3. Find the names of all students studying information technology (major=it) Exercise 4 Create a Crows Foot ERD for each of the following descriptions.(Note that the word many is meant to mean more than one in a database modelling environment.) a)Each of the MegaCo Corporations divisions is composed of many departments.Each of the departments has many employees assigned to it, but each employee works for only one

department.Each department is managed by one employee, and each of these managers can manage only one department at a time. b)During some period of time, a customer can rent many videotapes from the BigVid store.Each of the BigVids videotapes can be rented to many customers during that period of time. c)An airline can be assigned to fly many flights, but each flight is flown by only one airliner. d)The KwikTite Corporation operates many factories.Each factory is located in a region.Each region can be home to many of KwikTites factories.Each factory employs many employees, but each of these employees is employed by only one factory. e)An employee may have earned many degrees, and each degree may have been earned by many employees. Exercise 5 Pick and Shovel Construction Company is a multi-state building contractor specializing in medium-priced town homes. Assume that Pick and Shovels main entities are its customers, employees, projects and equipment. A customer can hire the company for more than one project, and employees sometimes work on more than one project at a time. Equipment, however, is assigned to only one project at a time. Draw an ERD showing those entities. Exercise 6 FastFlight Airlines is a small air carrier operating in three north-eastern states. FastFlight is in the process of computerizing its passenger reservation system. The following data items have been identified: reservation code, flight number, flight date, origin, destination, departure time, arrival time, passenger name, seat number, reservation agent number and reservation agent name. For example, flight number 303, which is scheduled every Tuesday and Thursday, leaves Augusta, Maine, at 9:23am and arrives in Nashua, New Hampshire at 10:17am. You can assume that the Fast Freight reservation system will detect automatically whether empty seats are available. Draw the Entity Relationship Diagram for this system.

Exercise 7 Give at least one example of your environment (real world) for each of the following relationships: (a) a one-to-one relationship (b) a one-to-many relationship (c) a many-to-many relationship Draw the corresponding Entity Relationship diagrams!

Exercise 8 (1) The following relational database represents students, their names, the subjects they are studying and the teacher teaching each subject. Assume each subject is taught by only one teacher. The database is poorly designed. Explain briefly what problems it has and suggest a better relational schema.

Student # 1234 1234 5678 5678 9876 9876 9876

StudentNam e Smith Smith Taylor Taylor White White White

Subjec t Maths Physic s Maths Biology Biology Maths Physic s

Teacher Gibbons Green Gibbons Harvey Harvey Gibbons Green

(2) Design a relational database for the following data. Exercise 9 A company database needs to store information about employees (identified by a social security number (ssn), with salary and phone as attributes) and departments (identified by dno, with dname and budget as attributes). Employees work in departments and each department is managed by one employee. Draw an ER diagram that captures this information. Be sure to indicate any key and participation constraints.

You might also like