Professional Documents
Culture Documents
2022-10-07 Assignemts ER MappingDBSchema Solutions
2022-10-07 Assignemts ER MappingDBSchema Solutions
1 N
Professors
CoursePaper
EL, ch.3.9.1: Although in general three binary relationships cannot replace a ternary
relationship, they may do so under certain additional constraints.
Let us see whether we can identify such “additional constraints”, that allow for a lossless
decomposition of a ternary relationship into binary relationships.
How can you decompose this ternary relationship with the cardinality of 1:1:1 and the given
additional binary constraint M:1 into binary relationships – without semantic loss.
Exercise 3:
A trainer can also be a member of the club, enroll in courses and have his / her minor
children in the club. A trainer does not need to be a member of the club.
The database also keeps track of the date, a trainer started to hold courses.
• Each area is headed by exactly one trainer. A trainer can head at most one area
• Members do not need to enroll in courses but they can enroll in as many courses
they like.
• Each course is taught by exactly one trainer. A trainer can teach up to 10 courses. He
can also currently not teach a course at all.
Exercise 5: Room Reservation ER Model
Add the following (min, max) cardinalities to your Room Reservation ER-Model:
• A maximum of 4 people sit in an office. Every employee sits in exactly one office.
employee (1,1) – works_in - office (0,4) or (1,4) - we do not know if empty offices are
allowed.
• There is exactly one department head per department. Not all employees are
department heads.
• All parking spaces are assigned but not every employee has a parking space.
The company “Internet Community Help” wants to manage their internet forums with a database.
The database needs to fulfill the following semantical requirements:
1. The database keeps track of the different forums. Each forum is stored with forumID, title and a
description of the forum topic. Forums contain posts.
2. Each post for each forum is stored with an increasing ID number, a title, the date it was written
and, of course, the text or content.
3. A post can have responses. The responses to a post are also posts and have the same attributes
as posts without responses.
4. The database keeps track of the users that work with the forums. For each user, the database
keeps track of the username and the user email. Users are allowed to describe themselves and
their skills in a separate field.
5. Users that want to participate need to register with each of the forums they want to use. The
database stores the date of the respective registration.
6. Users can write posts for the forums they are registered. They can also like posts. The database
stores the date when a user writes a post or “likes” a post.
7. Some of the users are moderators. Each forum is headed by a moderator. A moderator can only
head one forum.
1. Develop the corresponding ER-model, with entities, relationships and attributes.
2. Underline keys.
1. Write standard cardinalities for all relationships.
2. Add the following (min,max) cardinalities:
a. Each user has to register with at least one forum. A forum needs to have at least 10
users.
b. A moderator can only head one forum. Each forum is headed by exactly one moderator.
c. A forum must not have more than 200 posts. Each post belongs to exactly one forum.
d. A post may have at the most 10 responses. It does not need to have a response.
Correct entities (forum, post, user) with attributes. Minus if there are more entities that do not 1
make sense / do not have attributes / are not needed.
Correct relationships between user and forum: register and head. Attribute “date of registration” 2
directly at the relationship register
Correct relationships between user and post: write and like. Attribute “date of like” directly at the 2
relationship “like”
Exercise 7:
Map the exam ER model into the corresponding relations’ scheme. Underline PKs and mark
FKs. How many final relations do you get?
Student: {[stud_id:int]}
Exam: {[stud_id:int, exam_part:int, grade: enum]}
Professor: {[prof_id:int]}
Examination: {stud_id:int, exam_part:int, prof_id:int]}
Exercise 8:
Map the university ER model into the corresponding relations’ scheme. Underline PKs and
mark FKs. How many final relations do you get?