0% found this document useful (0 votes)
115 views6 pages

1.1. Exercices EER and Relational - Databases

The document provides 10 exercises to practice constructing entity-relationship (E-R) diagrams and reducing them to relational models. The exercises involve modeling databases for scenarios like a private school, university, city council records, online banking, retail stores, video rentals, and online dating. Students are asked to document assumptions, identify entities and relationships, and map the E-R diagrams to relational schemas.

Uploaded by

Victor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views6 pages

1.1. Exercices EER and Relational - Databases

The document provides 10 exercises to practice constructing entity-relationship (E-R) diagrams and reducing them to relational models. The exercises involve modeling databases for scenarios like a private school, university, city council records, online banking, retail stores, video rentals, and online dating. Students are asked to document assumptions, identify entities and relationships, and map the E-R diagrams to relational schemas.

Uploaded by

Victor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Universidad de León Databases –Informatics Engineering Degree

ENTITY-RELATIONSHIP MODEL AND RELATIONAL MODEL. EXERCICES


1 Construct an E-R diagram for a small private school that stores information about students, courses
and grades obtained in each course (and in each term).
Document all assumptions that you make about the mapping constraints (cardinality of
relationships).
Reduce the previous E-R diagram to a Relational one.

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

What is a Head of the Family?


An individual in one family setting who provides actual support and maintenance to one
or more individuals who are related to him or her through adoption, blood, or
marriage.
The designation head of household, also termed head of family, is applied to one
whose authority to exercise family control and to support the dependent members is
founded upon a moral or legal obligation or duty.

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

10 Construct and E-R diagram for the following situation, indicating:


§ The main attributes for each entity (all of them but the regular ones)
§ The Non-reflected semantic
§ If inheritance appears, specify the ISA design constraints
There is interest in controlling the electrical power produced and consumed in a country. The database
must reflect the following constraints:
1. There are power producers that are identify by their name and there is interest in storing the
average production by year, the maximum production and the date when they started to work.
They belong to one of the following categories: hydroelectric, solar, nuclear or thermal. For
the Hydroelectric plants the maximum capacity, the current workload and the number of
turbines will be stored. For the Solar plants the overall solar panels surface, the average hours
of sunlight per year (and from each year) and the type (photovoltaic or thermodynamic). For
the Nuclear power plants the number of reactors, the plutonium volume and the nuclear waste
volume (overall) produced will be stored. For the Thermal power stations the number of
heaters, the volume of coal consumed and the volume of gases emitted.
2. Due to national security reasons, it is necessary to know the amount of plutonium provided
to a nuclear plant. The database will store the amount of plutonium bought to each of their
suppliers (name and country) and transported by a private carrier (name and plate license
number). It is possible the same plutonium supplier have sold plutonium to a number of
nuclear plants and it is also possible each transportation (just one delivery for each purchase)
could be carried out by a different carrier.
3. Every day, each power producer delivers the produced power to a one or several primary
stations, which could receive daily a different amount of electric power from each power
producer. The power producers always deliver the whole production. The primary stations are
identified by its name and they have a number of low-to-high voltage transformers. At the
same time, each primary station could be header of several distribution networks.
4. A network number identifies every distribution network and it only has one primary station as
header. Any distribution network can be owned by several electrical companies (identified
by its name) at the same time.
5. The electrical energy that remains in any distribution network could be send to another
network. It is necessary to register the overall energy volume interchanged between two
networks.
6. A distribution network is composed by a number of lines. A sequential number for each
network identifies each line and it has a specific length. The smaller line provides electrical
power at least to two substations.
7. A substation is supplied by only one line and it distributes electrical power to one or many
service areas, identified by a ServiceAreaCode. For this purpose, states (provinces) (name,
statecode and population) are divided in several service areas but each service area belongs
just to one state. A service area can be supplied by many substations.
8. In each service area the average electrical consumption and the number of consumers
belonging to common citizens, companies and government categories must be stored.
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.

4
Universidad de León Databases –Informatics Engineering Degree

5
Universidad de León Databases –Informatics Engineering Degree

11. Realizar un diagrama E/R (extendido) del siguiente problema, indicando:


§ Todos los atributos de las entidades y de las relaciones (si los tuvieran), y los atributos que son
clave primaria.
§ Señalar igualmente si el diagrama propuesto no recoge toda la semántica del problema,
indicando en este caso las restricciones necesarias para hacerlo.
§ Si aparece especialización o generalización, indicar el tipo.
El club de Ajedrez de la Universidad de León ha sido encargado por la Federación Internacional de
Ajedrez de la organización de los próximos campeonatos internacionales infantiles que se celebrarán
en esta localidad. Debido a esto, desea llevar a una base de datos toda la gestión relativa a
participantes, alojamientos y partidas. Para ello hay que tener en cuenta lo siguiente:
1. En el campeonato participan jugadores y árbitros. De ambos se requiere conocer el número de
asociado, nombre, dirección, teléfono de contacto y campeonatos en los que han participado
(como jugador o como árbitro). De los jugadores se precisa además el nivel de juego en una
escala de 1 a 10.
2. Ningún árbitro puede participar como jugador.
3. Los países envían al campeonato un conjunto de jugadores y árbitros, aunque no todos los países
envían participantes. Todo jugador y árbitro es enviado por un único país. Un país puede ser
representado por otro país.
4. Cada país se identifica por un número correlativo según su orden alfabético e interesa conocer
además de su nombre, el número de clubes de ajedrez existentes en el mismo.
5. Cada partida se identifica por un número correlativo (CodPar), la juegan dos jugadores y la
arbitra un árbitro. Interesa registrar las partidas que juega cada jugador y el color (blancas o
negras) con el que juega. Ha de tenerse en cuenta que un árbitro no puede arbitrar a jugadores
enviados por el mismo país que le ha enviado a él.
6. Todo participante compite en al menos una partida.
7. Tanto jugadores como árbitros se alojan en uno de los hoteles en los que se desarrollan las
partidas, se desea conocer en qué hotel y en qué fechas se ha alojado cada uno de los
participantes. Los participantes pueden no permanecer en León durante todo el campeonato,
siendo posible que acudan únicamente cuando tienen que jugar alguna partida alojándose en el
mismo o distinto hotel. De cada hotel, se desea conocer el nombre, la dirección y el número de
teléfono.
8. El campeonato se desarrolla a lo largo de una serie de jornadas (año, mes, día) y cada partida
tiene lugar en una de las jornadas aunque no tengan lugar partidas todas las jornadas.
9. Cada partida se celebra en una de las salas de las que pueden disponer los hoteles; se desea
conocer el número de entradas vendidas en la sala para cada partida. De cada sala, se desea
conocer la capacidad y medios de que dispone (radio, televisión, vídeo,...) para facilitar la
retransmisión de los encuentros. Una sala puede disponer de varios medios distintos.
10. De cada partida se pretenden registrar todos los movimientos que la componen; la identificación
de movimiento se establece en base a un número de orden dentro de cada partida: para cada
movimiento se guarda la jugada (5 posiciones) y un breve comentario realizado por un experto.

You might also like