2022-10-21 Assignemts Normalization Implementation Solutions
2022-10-21 Assignemts Normalization Implementation Solutions
AFTER `DoB`;
Why does it have to be a generated virtual column and not a generated stored column?
Virtual: Dynamic generation when a row is queried / stored: evaluation on inserts and
updates – would not work with age.
Exercise 2:
Map the Internet Forum ER model into the corresponding relations’ scheme. Underline PKs
and mark FKs. Note, which FKs need a unique index and which must not have a unique index.
How many relations with what keys are created in each case?
Case 2) 1:N: A column with the foreign key to the primary key of the relation belonging to
the 1-side is added to the relation belonging to the N-side. It may be a partial participation.
Difference in implementation: In strong-weak entity case the PK of the strong entity is part
of the PK of the weak entity and FK at the same time and in the other case only a FK is
created.
Exercise 4: Normalization:
A 123456
1 skis 200
B 234567
2 tent 150
C 345678
3 snowshoes 100
D 589944
4 boots 50
1 Vienna A 50
1 Munich B 25
2 Berlin C 10
3 Berlin A 50
4 Vienna A 150
4 Cologne A 5
4 Munich B 15
4 Munich D 5
Berlin
Cologne
Munich
Vienna
5. Do some reverse engineering and draw a well designed ER-model out of your relations.
A) The following table empProject keeps track of which employee works on what
projects in what function. Of each employee, the relation stores the social security
number and the employee ID. Employees can work on different projects and can
have a different function in each project they work on. The table also keeps track of
the date that an employee started to work on the project.
EmpProject
SSN Emp_ID,
Emp_ID SSN
{SSN, Project} function, startDate
{Emp_ID,project} function, startDate
3. 3rd NF
B) Georgian Version: An agency manages in its database IT Freelance people that work
for different companies on different projects.
CompanyNa
SSN CompanyID Function Project startDate
me
01136 1 TBG Bank ProjectManager ERP 2020-01-01
74589 2 Bank Imereti Developer ERP 2020-10-01
55587 3 Telavi Wines ProjectManager Portal 2019-10-01
01136 4 Poti Port Tester CRM 2021-02-01
12345 4 Poti Port Developer Portal 2019-11-01
12345 4 Poti Port Tester Linux 2021-01-01
Solution 1: project name is not unique
Solution 3: CompanyID and CompanyName are unique but projectName is not unique
The airline DB-Air wants to manage their resource planning with a database. The database needs to
fulfill the following semantical requirements:
1. The database keeps track of the technical employees of the airline: For each technical employee
the database stores ID and name. Technical employees are either pilots or maintenance
technicians. The database stores the overall flight experience (in hours) that each pilot has.
2. A pilot may only fly the airline types that he / she has a license for. The database keeps track of
the date of issue of each respective license.
3. Each experienced pilot may mentor young pilots. Each young pilot may only have one mentor.
4. Each maintenance technician works in a maintenance team. Each team has an ID. One of the
technicians is the leader of the maintenance team. The database keeps track which aircraft types
a team can maintain.
5. The database keeps track of all aircrafts that the airline uses. It stores aircraft ID, aircraft name,
purchase date, date of last full maintenance, teamID of the team that carried out the last
maintenance and aircraft type.
6. The information that is stored with the aircraft type is type code, name and maximum
occupancy.
7. All airports that the airline flies to are stored with the airport code, name and country. For each
airport the database keeps track which aircraft types have a landing permission for that airport.
Correct entities (aircraft, aircraftType, maintenanceTeam, airport), minus if there are more 2
entities that do not make sense / do not have attributes / are not needed.
Correct disjunct specialization / generalization (total and partial are both correct): technical 1
employee – pilot – technician.
Bonus point: country as separate reference table (does not need to be extra in EER.) (1)