Relational Databases First Midterm Exam 21.11.2023 Group 6
Relational Databases First Midterm Exam 21.11.2023 Group 6
1. For the given ER diagram, write the relational model. Also, identify the primary and foreign
key(s) (underline primary key(s), and put an asterisk symbol (*) on foreign key(s)). (30 points)
Result
Team2
TName
Placement
Team1
Coach
Matches
MatchID
1 M 1 1 M
Teams
Doctor
RName
1 1 1
PlayID Round Type RTypeID
FirstName
M
DetID
LastName M
Players 1 M Detail
DateBirth
M M
CurrClub
Position
Groups ActID
1 1
Name
Activity
City
Type
Stadium 1 SchID
Schedule Date
Time
Referee
Stadium City
2. Draw an ER diagram to create a beauty salon database, which will contain the following
information: (30 points)
• The ER diagram will keep track of the employees, customers, products and their
services.
• For each employee the beauty salon will keep track of a unique employee ID, their
first and last name, phone number, date of birth, specialty, city and salary.
• For each customers the beauty salon will keep track of a costumer ID, their first and
last name and their phone number.
• For each product the beauty salon will keep track of unique product ID, type of the
product and the product name.
• The beauty salon keeps track of services.
• Every customer can make an appointment. Many customers can make many
appointments. The appointment will keep track of time and the date when the
appointment is scheduled.
• One service can be made by one employee.
• While working one employee can use many products.
• Many customers can buy many products.
a. Find the last names of the workers who work on a project titled “Automated Attendance
System”. (5)
b. Find the names of the workers who have not participated in any project. (5)
c. Find all workers with first name “Ardit” and last name “Bekteshi”. (5)
d. Find the duration of a project titled “Banking Bot Project”. (5)
e. Find the position of a workers with salary less and equal to 25000 denars. (5)
4. Consider the following database:
Publisher
Author
Book
a) How many tuples will be returned by the following relational algebra query? Explain! (3)
b) What is the result of the following relational algebra query? Explain! (4)
PubID(Book) – PubID(Publisher)
c) How many tuples will be returned by the following relational algebra query? Explain! (4)
Author x Publisher x Book