110 likes | 1.25k Vues
Entity - Relationship Modelling Exercises by Artem Chebotko. Exercise 1. Draw an ER diagram and translate it to the relational model for the following: A customer orders at least one book from a bookstore. A bookstore can process (orders from) many (or none) customers.
E N D
Exercise 1 • Draw an ER diagram and translate it to the relational model for the following: • A customer orders at least one book from a bookstore. • A bookstore can process (orders from) many (or none) customers. • A book can be ordered many (or zero) times.
Exercise 2 • Draw an ER diagram and translate it to the relational model for the following: • A customer places at least one order. • An order is placed by exactly one customer. • An order is sent to exactly one bookstore. • A bookstore handles many (or none) orders. • An order includes at least one book. • A book can be included in many (or zero) orders.
Exercise 3 • Draw an ER diagram and translate it to the relational model for the following: • An animal shelter has many (or none) pets. • A pet can be a cat or a dog. No other kinds of animals are allowed in a shelter. • A pet is characterized by a tag (unique id), name, breed, age, coat, pattern, and weight.
Exercise 4 • Draw an ER diagram and translate it to the relational model for the following: • An animal shelter has many (or none) pets. • A pet can be a cat or a dog. No other kinds of animals are allowed in a shelter. • A pet is characterized by a tag (unique id), name, breed, age, coat, pattern, and weight. In addition, height and other size characteristics are recorded for dogs and food preferences are recorded for cats. • A dog is walked by a volunteer at least twice a day.
Exercise 5 • Draw an ER diagram and translate it to the relational model for the following: • An animal shelter has many (or none) pets. • A pet can be a cat or a dog. Occasionally, a shelter hosts other kinds of animals (deer, raccoon, bird, etc.) that may require medical (veterinarian) treatment. • A pet is characterized by a tag (unique id), name, breed, age, coat, pattern, and weight.
Exercise 6 • Draw an ER diagram and translate it to the relational model for the following: • A computer programmer in a software development company is described by an employee id, name, phone, address, email, and set of skills (non-empty set). • A programmer works on many (or none) projects. • A project has at least one programmer assigned to it. • A project has a name, description, and set of skills (non-empty set) required to contribute to it.
Exercise 7 • Draw an ER diagram and translate it to the relational model for the following: • A university offers a number of courses. • A course may have one or more (or none) courses as prerequisites. • A course may or may not have one or more scheduled sections. • A professor teaches at least one course section. • A student is enrolled in at least three and at most seven course sections. • A professor assigns grades to students enrolled in a course section that s/he teaches.
Exercise 8 • Draw an ER diagram and translate it to the relational model for the following: • A bank offers three types of accounts: checking, savings, and loan/credit. • A checking account has account-number, date-opened, balance, and service-fee. • A savings account has account-number, date-opened, balance, and interest-rate. • A loan/credit account has account-number, date-opened, balance, service-fee, interest-rate, and credit-limit.