Presentation on theme: "Exercise 1 Consider the ER diagram below. Assume that an employee may work in up to two departments or may not be assigned to any department. Assume that."— Presentation transcript:
Exercise 1 Consider the ER diagram below. Assume that an employee may work in up to two departments or may not be assigned to any department. Assume that each department must have one and may have up to three phone numbers. Supply (min, max) constraints on this diagram. State clearly any additional assumptions you make. EMPLOYEEDEPARTMENT WORKS-IN HAS-PHONECONTAINS PHONE 1
Exercise 2 For each of the following pairs of rules, draw an ER diagram showing the cardinality and participation constraints: A doctor may treat many patients. A patient may have a designated or (treated by ) doctors for different types of problems. A hospital has many patient rooms. Each patient room belongs to that hospital. An author may write many books. A book written by more than one author. 2
Exercise 3 Identify the entities and relationships for the following description and draw an ER diagram. Persons subscribe to various journals. Each journal has a set of numbered volumes, and each of volumes has a set of numbered issues. Persons, described by their name, SSN, and address. journal, identified by a title and an ISBN. Subscribers have an initial subscription date and a termination date for each journal to which they subscribe.. 3
Exercise 4 Identify the entities and relationships for the following description and draw an ER diagram. A library system contains libraries, books, authors and patrons, with identifying attributes library Number, book number, author number, and patron number, respectively. Libraries are further described by a library name and location, books by title and page count, authors by author name, and patrons by patron name and. Libraries hold numerous books (some with multiple copies), each authored by one or more authors. Patrons borrow books, but at any point in time, may not have anything checked out. When they do have a book checked out, there is a due date associated with it. 4
Exercise 5 Identify the entities and relationships for the following description and draw an ER diagram. Departments, identified by ID, operate a variety of printers, each located in a particular room in a particular building. Printers are supplied by a number of suppliers, identified by name, with each supplier charging a different price for a given printer, but also providing different delivery delays, measured in days. A given room can have any number of printers, including none. 5
Exercise 6 A loan company wants to design a database to track student loans. Each student attending school is eligible for a loan. A student may have more than one loan. A student may be registered, possibly at different times, in more than one school. Each loan should belong to only one bank. Each bank can approve as many loans as it desires. For each loan, the loan company will track: the students SSN, name, address, amount of loan, date of loan, interest rate ( which may be different for each loan as determined by the bank), duration of loan, monthly payment, remaining balance, school ID, school name and address, number of years the student has been at the school, bank name, bank branch and bank ID. Draw an ER diagram. State any assumptions you make in the diagram.