You are on page 1of 18

Taller 2 Ejercicios diagramas

ER
Jerson Felipe Benavides Cortés
Construcción de bases de datos
Ejercicio 1
Construct an E-R diagram for a car-insurance company whose customers own one or more cars
each. Each car has associated with it zero to any number of recorded accidents. Register basic
information about each entity.
COSTUMERS
ID Name Phone Number Address
1 Adrian Perez 3256541256 Calle 1 # 2 - 3
2 Liz Muñoz 3012563258 Calle 1 # 2 - 4 Car
3 Juan Avila 3142568914 Calle 1 # 2 - 5 Placa Marca Modelo
4 Pedro Cortés 3224785210 Calle 1 # 2 - 6 asd 123 Renault 3445
dfr 121 Toyota 8950
wer 159 Chevrolet 4555
jhn 859 BMW 2655
Accident
Costumer Car hour place
1 asd 123 1:00 Bogotá
2 dfr 121 10:00 Cali
3 wer 159 14:00 Medellin
4 jhn 859 15:02 Buga
Ejercicio 2
Construct an E-R diagram for a hospital with a set of patients and a set of medical doctors. Associate with each
patient a log of the various tests and examinations conducted. Register basic information about each entity.
Patient
ID Name Age Address
1 Adrian Perez 14 Calle 1 # 2 - 3
2 Liz Muñoz 35 Calle 1 # 2 - 4
3 Juan Avila 42 Calle 1 # 2 - 5
4 Pedro Cortés 10 Calle 1 # 2 - 6
Doctor
ID Name Specialty
D1 Jose Martinez Pediatry
D2 Andres Parra Cardio
D3 Roberto Rijas Orto
Test D4 Luis Mora Neuro
Name Result Doctor Patient
TDH + D1 1
Scan + D2 2
Lipids - D3 3
Glyceia + D4 4
Ejercicio 3

Construct an E-R diagram for the registrar’s office. A university registrar’s office maintains data about the following entities:

• a. courses, including number, title, credits, syllabus, and prerequisites.

• b. course offerings, including course number, year, semester, section number, instructor(s), timings, and classroom.

• c. students, including student-id, name, and program.

• d. instructors, including identification number, name, department, and title. Further, the enrollment of students in courses and grades awarded to students in each course they
are enrolled for must be appropriately modeled.
Courses Student
Number Tittle Syllabus Credits Prerequisites ID Name Program
123 Math 2 pdf1 3 Math 1 Adrian Perez Medicine
124 Biology 2 pdf2 3 Biology 2 Liz Muñoz Math
125 Chemestry 2 pdf3 3 Chemestry 3 Juan Avila Software engineer
126 Spanish 2 pdf4 3 Spanish 4 Pedro Cortés Vet

Instructor
ID Name Department Tittle
I1 Andres Cortes Sciences PhD Chemestry
I2 Luis Martinez Marketing PhD Marketing
I3 Carlos Castro Culture PhD Sociology
I4 Jose Frias Medicine PhD Medicine

Course Offering
Course number Instructor Student year semester Section number Timings Classroom
123 Andres Cortes Adrian Perez 2022 2 22 M 8-10 A 101
124 Luis Martinez Liz Muñoz 2022 2 23 W 8-10 B 101
125 Carlos Castro Juan Avila 2023 1 24 F 6-8 C 101
126 Jose Frias Pedro Cortes 2023 1 23 W14-16 D101
Ejercicio 4
A bank has a list of customers. Every bank has its own name and multiple branches. Each branch has a code, name, address (number,
street, city) and set of phones. Customers give their name, permanent address (number, street, city, zip code and country), mobile
phone number and social security number. Accounts have branch code followed by a number the type of account (such as saving or
current) and the balance. All customers don't have to have bank accounts and each customer can only have up to two accounts.
There can only be one customer per account
Account
Code Balance Costumer Branch
1 100000 123 b1
2 500000 124 b2
3 1000000 125 b3
4 2000000 126 b4

Costumer Branch
SS number name phone address Code phones name address
123 Ana 3143443858 calle 1 # 2 -1 b1 3102563156 Las aguas cra 1 # 1- 2
124 Juan 3215896325 calle 1 # 2 -2 b2 3218932547 Centro internacional cra 1 # 1- 3
125 Pedro 3102567893 calle 1 # 2 -3 b3 3148953617 Restrepo cra 1 # 1- 4
126 david 3104785923 calle 1 # 2 -4 b4 3113592244 Centro Mayor cra 1 # 1- 5
Ejercicio 5
Construct an E-R diagram for a database used to record the marks that students get in different exams of different course offerings.
Student
ID name Program
1 Andres Cortes Medicine
2 Luis Martinez Math
3 Carlos Castro Chemestry
4 Jose Frias Data science
Course
Number title Credits
123 Math 2 3
124 Biology 2 3
125 Chemestry 2 3
126 Spanish 2 3

Exam
Student Course date result
1 123 12-oct 5
2 124 25-sep 4,5
3 125 12-ago 3
4 126 18-jul 2,5
Ejercicio 6
Design an E-R diagram for keeping track of the exploits of your favorite sports team. You should store the matches played, the scores
in each match, the players in each match and individual player statistics for each match. Summary statistics should be modeled as
derived attributes.
Match
ID Stadium Date score_Own score_Op
1 Campin 1-feb 1 2
2 Atanasio 2-feb 3 3
3 Bombonera 3-feb 4 2
4 Maracana 4-feb 1 1

Player
name age players score
Andres Cortes 25 15
Luis Martinez 30 10
Carlos Castro 28 8
Jose Frias 22 18
Ejercicio 7
Extend the E-R diagram of the previous question to track the same information for all teams in a league.
Match Team Player
ID Stadium Date score_Own score_Op name ranking name age players score
1 Campin 1-feb 1 2 Millonarios 1 Andres Cortes 25 15
2 Atanasio 2-feb 3 3 Santa Fe 4 Luis Martinez 30 10
3 Bombonera 3-feb 4 2 America 2 Carlos Castro 28 8
4 Maracana 4-feb 1 1 Junior 3 Jose Frias 22 18
Ejercicio 8
Show an E-R diagram illustrating for a university database and the scheduling of classrooms for final exams. This database
could be modeled as the single entity set exam, with attributes course-name, section-number, room-number, and time.
Alternatively, one or more additional entity sets could be defined, along with relationship sets to replace some of the
attributes of the exam entity set, as
• a. course with attributes name, department, and c-number
• b. section with attributes s-number and enrollment, and dependent as a weak entity set on course.
• c. room with attributes r-number, capacity, and building
ROOM
R_Number Capacity Building
1 20 1
2 35 2
3 40 3
4 28 4

EXAM SECTION COURSE


ID time S_number Enrollment Number Name
E1 M 8-10 S1 123 1120 Math 1
E2 W 10 - 12 S2 124 1121 Chemestry 1
E3 F 7-9 S3 125 1122 Biology 1
E4 S 10-12 S4 126 1123 Spanish 1

You might also like