Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

1.

Draw an ERD diagram for the following case


Consider the following information about a university database:

• Each student has an id (sid), a name (sname), a major study direction (major) and
an date of birth(dob).

• Each course has a name (cname) and description (cdesc).

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

2. An Electricity Company wishes to create a database with the following entities and
attributes:
• Customer, with attributes Customer ID, Name, and Telephone
• Location, with attributes Location ID, Address (Street, City, State, Zip Code), and
Type (values of Business or Residential)
• Rate, with attributes Rate Class and RatePerKWH
After interviews you have come up with the following business rules:
• Customers have one or more locations.
• Each location has one or more rates, depending on the time of day. Rate varied,
depends on locations. This means: in different time of day, rate for the same location
may be different. One rate can be applied to different locations.

3. Suppose you and your friends are starting a social network service called
MyFriends".
Now you are trying to design the database schema to store user information,
which should meet the following requirements:
• For every user, we record his/her name and a unique email address. •
People make friends with other people. A user may have zero or more friends.
• Each user owns a profile page and may post on his/her own or other people’s
profile pages. Each post contains some text and is identified by the author,
the owner of the page on which it appears, and the time-stamp. The posts are
allowed to contain tags that mention other people, e.g., using the @ syntax.

Note we do not need to explicitly record the profile pages since each page is
uniquely associated with a user.
A. Draw an ER diagram for this database. Make sure to indicate primary keys,
cardinality constraints, weak entities, and participation constraints if any. List the
assumptions you make in the process.
B. Translate the ER diagram into relational database tables. Make sure that the
translation captures any key and participation constraints in the ER diagram.

You might also like