What is the cardinality and existence of each of the following relationships in just the direction given? State any assumptions you have to make.
- Husband to wife
- Student to degree
- Child to parent
- Player to team
- Student to course
For each of the following pairs of rules, identify two entity types and one relationship. State the cardinality and existence of the relationship in each case. If you don't think enough information is available to define either of these, then state an assumption that makes it clear. Draw the ER diagram.
- A department employs many persons. A person is employed by, at most, one department.
- A manager manages, at most, one department. A department is managed by, at most, one manager.
- An author may write many books. A book may be written by many authors.
- A team consists of many players. A player plays for only one team.
- A lecturer teaches, at most, one course. A course is taught by exactly one lecturer.
- A flight-leg connects two airports. An airport is used by many flight-legs.
- A purchase order may be for many products. A product may appear on many purchase orders.
- A customer may submit many orders. An order is for exactly one customer.
Draw an ER diagram for the following. Be sure to indicate the existence and cardinality for each relationship.
- A college runs many classes. Each class may be taught by several teachers, and a teacher may teach several classes. A particular class always uses the same room. Because classes may meet at different times or on different evenings, it is possible for different classes to use the same room.
- Each employee in an engineering company has at most one recognized skill, but a given skill may be possessed by several employees. An employee is able to operate a given machine-type (e.g., lathe, grinder) if he has one of several skills, but each skill is associated with the operation of only one machine type. Possession of a given skill (e.g., mechanic, electrician) allows an employee to maintain several machine-types, although maintenance of any given machine-type requires a specific skill (e.g., a lathe must be maintained by a mechanic).
Draw an ER diagram for each of the following situations. On the diagram be sure to identify the cardinality, existence, and optionality (for subtypes) of each relationship.
- A company has a number of employees. Each employee may be assigned to one or more projects, or may not be assigned to a project. A project must have at least one employee assigned, and may have several employees assigned.
- A university has a large number of courses in its catalog. Each course may have one or more other courses as prerequisistes, or may have no prerequisites.
- A college course may have one or more scheduled sections, or may not have a scheduled section.
- A hospital patient has a patient history. Each patient has one or more history records (we assume that the initial patient visit is always recorded as an instance of the history). Each patient history record belongs to exactly one patient.
- A video store may stock more than one copy of a given movie. It is also true that the store may not have a single copy of a paticular movie.
Draw an ER diagram to represent the following entity types and the natural relationships among them: Vehicle, Land-vehicle, Air-vehicle, Water-vehicle, Ocean-vessel, River-raft, Helicopter, Rail-vehicle, Road-vehicle, Car, Airplane, Bicycle.
Draw an ER diagram that best represents the following situation. There are three types of accounts in a bank, with these attributes:
- Checking: Acct-no, Date-opened, Balance, Service-charge
- Savings: Acct-no, Date-opened, Balance, Interest-rate
- Loan: Acct-no, Date-opened, Balance, Acct-limit
Consider the following diagram:
- What are the minimum and maximum number of Cs that can be associated with any one A? This is the same as asking “What are the existence and cardinality for the C to A relationship?”
- Substitute A:person and B:manage and C:project in the above ER diagram. Suppose that someone told you that the following three facts are true. Are these consistent with the diagram? Answer yes or no for each of the three facts. If your answer is no, then explain why it is inconsistent.
- Mackenzie manages the White project.
- Lindsey manages the Brown and Black projects.
- Joe doesn't manage any projects.
The following facts make up all of the leads relation between person and project:
- Jennifer leads the Southpark project.
- Jennifer leads the Briarwood project.
- Don leads the Eastgate project.
You do not know whether or not there are any other people or any other projects. Which diagram(s) that is (are) consistent with this set of three facts. For example, you might answer “1, 4” if both 1 and 4 are consistent with the above facts.
For each of the following sets of sentences, draw the corresponding ER diagram.
- An account can be charged against many projects, though it may not be charged against any. A project must have at least one, though it may have many, accounts charged against it.
- Projects must be classified as either top secret or civilian (but not both). There is information specific to top secret projects and specific to civilian projects that we want to record.
- An employee must manage exactly one department. A department may or may not have one employee manage it.
- Men are only allowed to supervise men. Women are only allowed to supervise women. We do not want to allow the database to hold data representing a man supervising a woman. An employee, regardless of sex, is assigned to exactly one office, with each office having exactly one employee in it. (Be sure to include the office entity in this diagram.)
The following descriptions all have to do with a holding company for food service companies. You should answer each one separately from the others.
- Each chain consists of 50 to 300 stores that are owned by ACTME, the holding company for several restaurant chains and two caterers.
- Menu items are wide ranging, and can be classified by the section of the menu (appetizer, dessert, etc.) in which each is presented and by ethnic group (Italian, Hungarian, etc.) to which it belongs.
- The menu of each restaurant changes every couple months; management likes to keep track of past menus to track which ones have been successful.
- Each menu item is made of several ingredients (eggs, bacon, etc.) that are used in a certain quantity.
- Ingredients can be acquired from several suppliers. Ingredients are acquired by sending orders for several goods using the vendor's item numbers. The item number for each of these ingredients varies across suppliers, so if you are going to order eggs from supplier # 1, then you might order item 52 while from supplier # 2 you might order item J216. The company keeps price and item numbers for all the ingredients for all its menu items — and even for some ingredients which it is not currently using in any menu items. The quantity needed for each ingredient is also kept. The current price of these goods is maintained though the historical price is not. Because of special deals and volume discounts, the price at which a good is acquired is often different from its list price. Thus, the database must retain the price at which a good is actually acquired.