Uploaded by amit sai jai

HW1

advertisement
CS-GY 6083-A, Principles of Database Systems, Fall 2022
Homework 1: Entity-Relationship and Relational Models
Assigned on Monday, September 19, 2022
Due at 11:59pm EDT on Friday, September 30, 2022
Description
This assignment covers the following topics
(1) Sets
(2) ER model
(3) Relational model
I do not expect you to use any special software to draw ER diagrams. The easiest way is to
print out this assignment, draw the diagrams by hand, scan in, and submit.
Grading
This assignment is made up of 3 problems, collectively worth 60 points, or 10% of the overall
course grade. Homeworks must be submitted on time. Each student can make use of 2
additional days for late homework submission over the course of the semester. If a late day is
used, it is used in full. That is, if a student submits an assignment 2 hours late, this counts as a
full day.
This and all other homework assignments are to be completed individually. Please consult the
course syllabus for a description of our academic honesty policy.
Submission instructions
Submit your answers for Parts 1 and 2 on BrightSpace. We prefer submissions in PDF format,
but other reasonable formats will be accepted as well. Submit Part 3 using the Gradiance
system, see Part 3 description for details.
Note that the BrightSpace assignment lists Friday, September 30, 2022 + 48 hours = Sunday,
October 2, 2022 as the due date, to allow us to receive submissions that come in late, but
within the 2 late day period. The actual submission deadline is Friday, September 30, 2022.
Part 1 (12 pts): Sets
Let us denote by B the set of all books, by F the set of fiction books, by N the set of books that
were on the New York Times bestseller list, by P the set of books that appeared in print, by E
the set of books that appeared as e-books only (not also in print), by M the set of books written
by men, by W the set of books that were written by women, and by Z the set of books that
were written by a person who identifies as non-binary.
For each question below, use set notation reviewed in class to write down an expression that
represents the result being described. Write exactly one expression for each question. To
avoid confusion, you should use “\” to denote set difference and “-” to denote the difference
between two numbers. Note that books may be authored by a single person, or they may be
co-authored by multiple people. When we say that a book was “written” by someone, we mean
that it was either authored or co-authored by that individual.
(a) (3 points) The set of fiction bestsellers co-authored by a woman and a person who identifies
as non-binary.
(b) (3 points) Difference between the number of fiction bestsellers that appeared in print only
and the number of non-fiction bestsellers.
(c) (3 points) The set of books that either were not featured on the New York Times bestseller
list and were written by a man; or are nonfiction and were written by a woman.
(d) (3 points) All possible 3-tuples of books such that the first is a non-fiction book that
appeared in print, the second is a fiction book not written by a man, and the third is a fiction
book not written by a woman.
Problem 2 (30 points) Business rules to ER diagrams
For each question below, draw an ER diagram that correctly represents the business rules.
Assume that the only business rules that hold are those stated, and that no additional business
rules hold. Clearly mark all key and participation constraints using the notation presented in
class.
(a) (10 points) Diseases are identified by a name, and are further described by the primary
structure they affect and by a prognosis. Viruses are identified by a genus and a species.
Some diseases are caused by viruses. Only viruses that cause some disease are recorded in
our database. Symptoms are identified by a name, and are further described by severity and
duration. Each symptom is associated with at least one disease, and each disease has one or
several symptoms.
Patients are identified by a social security number (SSN), and also have a name and an age.
Each patient is being treated for exactly one disease by exactly one doctor. Doctors are
identified by a social security number (SSN), and also have a name and an age. A doctor can
treat any number of patients, and they can treat any disease.
(b) (10 points) Stars are identified by a name and are further described by brightness and
metallicity. Planets are identified by a name and are further described by diameter and mass.
Each planet orbits exactly one star, and when we record this – we also record information
about the orbital period.
Satellites orbit planets, and are only included in our database if the planet they orbit is in the
database. A satellite has a name, but two satellites that orbit two different planets may have
the same name.
Deities are identified by a name and a mythology (e.g., Mars is a deity of ancient Roman
mythology). Some planets are named after deities. If a planet is named after a deity, then it’s
just one deity that gives the planet its name.
(c) (10 points) Cocktails are identified by a name, and also have a price. Cocktails contain
ingredients, which are identified by a name and are further described by a cost and an ABV
(alcohol by volume). Every cocktail has at least one ingredient.
Bars are identified by a name and a zip code. Every bar serves at least one cocktail, and has
exactly one specialty cocktail. If a cocktail is a specialty of some bar, then no other bar can
have that same cocktail as their specialty.
Part 3 (18 pts): Gradiance
You will use Gradiance to complete some of the homework assignments in this course. To
access Gradiance, you must create a Gradiance account at
http://www.gradiance.com/services, and then use this account to log on to the system. Having
logged on, sign up for a new class, specifying the following class token: 2891CA2C.
When you enter the token above, CS-GY 6083-A will appear under "Your Classes". Click on the
link for CS-GY 6083-A, and then follow the link to homeworks in the menu on the left. You will
see the currently assigned homework, and will be able to open it and submit solutions.
Gradiance will automatically grade your submissions and record your scores. We will retrieve
your scores for this part of the assignment directly from Gradiance, there is no need to submit
anything through NYU Classes for this part of the assignment.
Download