1.1. Exercices EER and Relational - Databases
1.1. Exercices EER and Relational - Databases
2 Consider a university database for storing information related to students, courses and academic
degrees. Construct an E-R diagram a lately reduce it to a Relational one. Model the database using
the following constraints:
1. Each student could be enrolled in several courses
2. One course belongs just to one degree
3. One degree is usually composed of several courses
4. It does not exist degrees having the same name
5. The degrees are identified by a unique code
6. Grades obtained in each course and term must be reflected
Add fields and the necessary information for obtaining a correct model. Document all
assumptions that you make about the mapping constraints.
Reduce the previous E-R diagram to a Relational one.
3 Consider the entity sets “Worker” and “Computer”. Construct an E-R diagram for each of the
following cases:
§ Case 1: Each worker has one computer that is only used by himself
§ Case 2: Each worker has one or several computers (laptop, desktop computer, etc.) but his
or her computers are used only by himself
§ Case 3: Each worker has one computer that (could) share with other workers.
§ Case 4: Each worker has one or several computers. Each computer can be used by several
workers (for instance, a shared laptop).
4 Construct an E-R diagram for storing information related to city councils, homes and people (living
in homes). Each person can live in a house and can be registered in only one city council. But each
person could be the owner of several houses. A house is registered in a city council. It is also
necessary to know which persons are dependent on the head of the family (HoF).
Document all assumptions that you make about the mapping constraints. Reduce the previous E-
R diagram to a Relational one. Add fields and the necessary information for obtaining a correct
model
1
Universidad de León Databases –Informatics Engineering Degree
5 Draw and E-R diagram for storing information in a University related to students, courses and
instructors (professors). Make sure your design includes at least the following:
1. A course could be taught by many professors (instructors) at a given term
2. A course may exist even if no students are currently enrolled
3. A course could have many prerequisites (subjects –previous courses- you must pass for
entry into a particular course)
4. It does not exist courses having the same name
5. An instructor may teach one or more courses in a given term
6. The instructor could have a rank of Lecturer, Teaching Assistant, Assistant Professor,
Associate Professor or Professor
7. A student must select at least one course per term
8. It is necessary to store the grade obtained for each student in each course and who was the
instructor that graded it
9. The average enrolment in a course is 45 students
In a University, the “teachers” are ranked as [instructor, teaching assistant, lecturer], assistant
professor, associate professor, and professor. Colleges and universities usually hire new tenure-
track faculty as instructors or assistant professors under term contracts.
Document all assumptions that you make about the mapping constraints.
Reduce the previous E-R diagram to a Relational one. Add fields and the necessary information
for obtaining a correct model
6 Construct and E-R diagram for a bank containing information related to customers, accounts,
branches and the account movements happened. Make sure your design includes at least the
following:
1. An account movement is given by “the movement number”, the date and the amount
2. An account movement is any movement carried out over a checking account such as debits,
credits or direct billings (domiciliaciones). Some of them are not carried out by customer of
the bank
3. A customer could have more than one checking account
4. An account could be owned by more than one person
5. An account is related to a single branch
Document all assumptions that you make about the mapping constraints.
Reduce the previous E-R diagram to a Relational one. Add fields and the necessary information
for obtaining a correct model
7 Construct and E-R diagram for a shopping center, similar to “El Corte Inglés”, which is organized by
departments. It must contain information about customers, employees, products and sales. Make sure
your design includes at least the following:
1. There are three types of employees: salespersons, supervisors and managers
2. Each department is run by a manager
3. A product belongs to a single department
4. Both salespersons and supervisors belong to a single department
5. A salesperson reports to a single supervisor and a supervisor reports to a single manager
6. A sale is carried out by a salesman to a customer and it is necessary to reflect the sold
product. Just one product
Document all assumptions that you make about the mapping constraints.
Reduce the previous E-R diagram to a Relational one. Add fields and the necessary information
for obtaining a correct model
2
Universidad de León Databases –Informatics Engineering Degree
8 Construct and E-R diagram for a video and music rental store, similar to “Casablanca” or
Blockbuster. It will store information about employees, customers and products (DVDs and CDs).
Include in your design at least the following constraints:
1. A customer could have rented several music CDs or DVD movies
2. A customer could have several addresses
3. A DVD movie or a music CD could be rented just to one customer at the same time
4. An employee can manage the rental of many DVDs or CDs
5. In any rental, the customer, the product, the employee and the date must be registered.
6. In the music CDs it is necessary to store information about the author (composer) or authors
and the singers –if any- and in the DVDs about the main characters in the movie
Document all assumptions that you make about the mapping constraints.
Reduce the previous E-R diagram to a Relational one. Add fields and the necessary information
for obtaining a correct model.
9 Construct and E-R diagram for an online dating site. It will contain information about men, women
and employees (divided in three categories: administrative assistants, personal agents and managing
directors). It will also store information about dates (day and hour, man and woman) and marriages
(day, woman and man). Include in your design at least the following constraints:
1. A man could date many women
2. A women could date many men
3. A man could get married with many women (but not at the same time.) He could become a
widower, a separated or divorced man.
4. A woman could get married with many men (but not at the same time). She could become a
widow, a separated or divorced woman.
5. Only the personal agents will promote a date
6. Both administrative assistants and personal agents report to managing directors
Document all assumptions that you make about the mapping constraints.
Reduce the previous E-R diagram to a Relational one. Add fields and the necessary information
for obtaining a correct model.
3
Universidad de León Databases –Informatics Engineering Degree
4
Universidad de León Databases –Informatics Engineering Degree
5
Universidad de León Databases –Informatics Engineering Degree