Vous êtes sur la page 1sur 7

Oefeningen Database Design

ENTITY must ENTITY

must

ENTITY must

ENTITY

must

ENTITY can

ENTITY

can

ENTITY can

ENTITY

can

1. Read the given business scenario. Name the relationships between EMPLOYEE and JOB. Include appropriate optionality and cardinality. We have a lot of employees who handle one or more different jobs. Wed like to keep track of who is working on which job. Although employees can help each other, a job is assigned to one employee and is the ultimate responsibility of that individual. All our employees have at least one job. However, there are jobs that are not yet assigned to anyone.

2. Read the given business scenario. Name the relationships between ORDER and WAITER, including the cardinality and optionality. We assign our waiters to certain areas, except for our trainees, who just observe and are not responsible for taking any orders yet. A waiter takes the orders for the tables in his/her area. All areas have one assigned waiter. A customer places an order with a waiter. If the customer has a question or wants to make a change to the order, he/she needs to request this with the assigned waiter.

3. Read the given business scenario. Name the relationships between TEACHER and STUDENT. Include appropriate optionality and cardinality. Some students request remedial help in certain subjects, such as math. We can assign a tutor who can work with the student after class. Some of our teachers agree to be tutors. If several students need tutoring in one subject, then we assign them to the same teacher. If a student needs tutoring in several subjects, then he/she will probably be assigned to several different tutors. 4. Read the given business scenario. Draw the entities HAIRSTYLIST and CLIENT. List the attributes associated with each entity and specify whether they are mandatory or optional. Identify the UIDs. Write out the relationship, including optionality and cardinality. Follow the diagramming conventions discussed. In our salon, we have a number of hairstylists. They are all salaried employees, so we keep a record of their first name, last name, address, phone number, social-security number, and salary. During the course of a day, a hairstylist may see several clients. On a slow day, a hairstylist may not work on anyone at all. We have several walk-in clients, and they each get assigned to one hairstylist. We just ask for their first name. We also have customers who call to make an appointment. When they do this, we ask for their first name, last name, and phone number. We also ask if they would like a specific hairstylist. If they have no preference, we assign one for them. Of course, they are allowed to switch to another hairstylist for their next visit to the salon. We are interested in tracking the daily appointments -- which stylist works on which client during a given day.

5. Read the given business scenario. Draw the entities BAND and MUSICIAN. List the attributes underneath each entity. Specify whether they are mandatory or optional. Identify the UIDs. Write out the relationships, including optionality and cardinality. I am an agent for several musicians and bands. A musician may be a solo performer or may belong to a band. A band will always have one or more musicians in it (some musicians are a oneman band). However, a musician can belong to only one band. Since I schedule them for concerts and events, I need to keep track of certain information: the musicians first name, last name, address, phone number, and hourly rate. If its a band, I need to know the band name in addition to the information I already keep for the member musicians. Ive handled bands with the same name, so just to make sure I book the right band, I assign an ID to each one. The hourly rate for a band is the total of the hourly rates of its members. 6. The goal of this practice is to read a relationship. Which text corresponds to the diagram?

a. Each EMPLOYEE may be assigned to one or more DEPARTMENTs.

Each DEPARTMENT must be responsible for one or more EMPLOYEEs. b. Each EMPLOYEE must be assigned to one and only one DEPARTMENT. Each DEPARTMENT must be responsible for one or more EMPLOYEEs. c. Each EMPLOYEE must be assigned to exactly one DEPARTMENT. Each DEPARTMENT may be responsible for exactly one EMPLOYEE.

7. Find the incorrect subtypes in the illustration. Explain why you think the subtype is incorrect. Adjust the model to improve it.

8. Koppel op een logische manier onderstaande entiteiten d.m.v. relaties

9. Draw softboxes for each of the following. Draw relationship lines and correctly label each relationship in both directions. Indicate non-transferability when appropriate. a) Each town may be the birthplace of many people. Each person must be born in one and only one town. b) Each room may house one or more guests. Each guest may stay in one and only one room. c) Each employee must work for one and only one department. Each department may have one or more employees. d) Each hotel may be the host of one or more guests. Each guest may be hosted in one or more hotels. e) Each fingerprint must belong to one and only one person. Each person must have one and only one fingerprint. f) Each child must have one and only one mother. Each mother must be the parent of one or more children.

10. Draw an entity relationship diagram to represent the following: Each CLUB must be assigned to one and only DEPARTMENT Each DEPARTMENT may be responsible for one or more CLUBs Each STUDENT may join one or more CLUBs Each CLUB may be composed of one or more STUDENTs 11. Resolve the M:M between INTERPRETER and LANGUAGE. For each intersection entity, think of additional attributes like a UID.

12. Match the type of Unique identifier to the entity. a) Simple UID b) Composite UID c) Composite UID comprising an attribute and a relationship d) Primary Key & Secondary Key 1 2 3 4

13. Check to see if each ERD is in 1NF. If not, make the necessary changes to correct it.

a)

b)

14. Class Enrollment is the intersection entity that resolves the M:M between STUDENT and CLASS. Does the ERD follow the rules of Second Normal Form? If you spot a violation, correct it.

15. A color scheme for a car includes specifications for paint color for the body and the interior colors and materials. For example: The Desert color scheme includes silver paint and gray leather interior; the Sunburst color scheme includes gold paint and cream leather interior. Does the model below follow the rules of Third Normal Form? If you spot a violation, correct it.

16. Speeding Tickets Each police officer may issue speeding tickets to motorists in an assigned area. Originally, the attribute date was modeled as part of the SPEEDING TICKET entity. However, the city police department wants to see if there is a relationship between weather and the frequency of speeding tickets -- do people drive faster on nice sunny days? Are there more tickets in hot weather or cool weather? Draw the ERD. 17. Comic-book collectors need to know the price history of different types of comics. This helps them decide what to purchase/collect and how much to sell their collection for. Create an ERD (two or three entities) to model this. 18. When a students grade is changed, we need to record information on the teacher who changed the grade and the reason for the change.

Start with the ENROLLMENT entity, which is the resolution of the M:M between STUDENT and CLASS.

19. Match the ERD elements to their corresponding database elements. Analysis Attribute Entity ER Model Instance Primary UID Relationship Secondary UID Design Column Foreign key Physical design Primary key Row Table Unique key

Voorbeelden

Vous aimerez peut-être aussi