Database Systems For Software Engineers SOEN 363 - Winter 2023 Assignment 1
Database Systems For Software Engineers SOEN 363 - Winter 2023 Assignment 1
Database Systems For Software Engineers SOEN 363 - Winter 2023 Assignment 1
1
1 Building a Database for Qatar Foundation [40 Points]
A recent meeting among the board of directors of Qatar Foundation (QF) has been concluded
with the decision of collecting and storing information pertaining to all organizations in QF
and their employees. The information will be used primarily for their emergency notification
system among other things. An expert (you!) has been hired to design their database given the
following description of entities and relations:
• Every organization has a unique name (e.g. Carnegie Mellon University in Qatar, Student
Center, etc.), address within QF, and contact numbers.
• One organization has many projects but one project is only assigned to one organization.
Each project has an id , a name , a start date and an end date
• One Project has many employees and each employee is a member of at least one project.
Also, the number of hours worked by an employee on a single project is recorded.
• An employee may work for several organizations, but must work for at least one. For
example, employee X may work for the Recreation Center in the morning and for the
Community Center in the afternoon. Accordingly, for every employee, we must record the
start and end times at each organization.
Page 2
2pts (a) Consider the Manages relationship between the entities Organization and Manager. Correct
the errors (if any) in the following E.R. Diagram. You may either use the thin/thick ’arrow’
notation of the book, or the M:N notation.
15pts (b) Draw the E.R. diagram for QF’s database as described above. Make sure to indicate primary
and partial keys, cardinality constraints, weak entities, and participation constraints where
applicable. Please state any assumptions that you make.
3pts (c) State whether the organization ISA hierarchy has (i) covering and/or (ii) overlapping
constraints. Explain briefly.
5pts (d) State whether the employee ISA hierarchy has (i) covering and/or (ii) overlapping con-
straints. Explain briefly.
15pts (e) Write SQL statements to create the tables corresponding to your E.R. diagram. Make sure
to indicate the primary keys and the foreign keys (if any). Do not specify on delete clauses
or check constraints.
10pts (a) Qatar Foundation records the name, phone number, and destination of a visitor. A visitor
can visit multiple destinations and QF records at least one. For example, a visitor can visit
CMUQ followed by the Student Center. An employee can be a visitor for another organi-
zation as well. Extend the E.R. diagram from Exercise 1 to include the entity visitor
and the associated relationship. Clearly indicate primary and partial keys, cardinality con-
straints, weak entities (if applicable), and participation constraints.
10pts (b) An employee is allowed to exercise at any Activities Center and is also allowed to have two
guests associated with him/her. Information stored about a guest is his/her name and age
and relationship with employee i.e (son, daughter, wife, husband, father, mother, brother,
sister, friend, etc..). Guests are assumed to accompany the employee at all times and,
hence, emergency messages are sent only to the employee. Once again, extend the E.R.
diagram from Exercise 2.A to include the entity guest and all given relationships. Clearly
indicate primary and partial keys, cardinality constraints, weak entities (if applicable), and
participation constraints.
10pts (c) Write the SQL statements representing the new tables of your E.R. diagram (Exercise 2.B
vs Exercise 1.B). Make sure to indicate primary keys, and foreign keys (if any). Do not
specify on delete clauses or check constraints.
Page 3
3 Building a Database for Hogwarts [30 Points]
In Harry Potter’s School of Wizardry, Hogwarts, fortune-telling is a hot business attracting
many witches and wizards. A fortune-telling center wishes to maintain information about their
customers. However, the center has realized the shortcomings of witchery and their dire need for
Databases. Therefore, they have invited a database expert (you!) to fly to Hogwarts to design
their database given the following description.
The center employs a number of fortune-tellers. Each fortune-teller has an ID, first name, last
name, hourly rate, and method used (e.g. tarot, astrology etc.). A magician (witch/wizard) can
schedule a session with a specific fortune-teller on a specific date and for any desired duration.
Of course, a fortune teller can see as many magicians as possible in a day. Most importantly,
the predictions made during a session for a magician, including love, wealth, career, and luck
are stored for reference. This ensures that this information is available when making predictions
in later sessions for the same magician.
6pts (a) Draw the E.R. diagram for the fortune-telling database as described above. Make sure to
indicate primary and partial keys, cardinality constraints, weak entities, and participation
constraints where applicable. Please state any assumptions you make.
12pts (b) Write SQL statements to create tables corresponding to your E.R. diagram. Make sure to
indicate primary keys, and foreign keys (if any). Do not specify on delete clauses or check
constraints.
12pts (c) When a magician arrives for a session, the fortune-teller must see the history of predictions
which were made for that magician in the past. Write a view to achieve this task.
Page 4
4 Submission
• The assignment is due at 11:59PM on February 05, 2023.
– Your answers for the problems as a single PDF document with the following name
pattern:
assignment1_<FIRST NAME>_<LAST NAME>_<STUDENT ID>.pdf
– A signed "Concordia Expectation of Originality" form found here: https://www.
concordia.ca/content/dam/ginacody/docs/Expectations-of-Originality-Feb14-2012.
pdf
• We highly encourage the use of digital tools to create ER diagrams such as: https:
//app.diagrams.net/. The rest of the problems must be digitally typed (photos of
handwritten answers are not allowed).
• If you have any problems with the submission, contact your respective TA:
5 Late Policy
• If you hand in on time, there is no penalty.
• More than 48 hours late = you lose all the points for this project.
Page 5