In this assignment, you will design a few simple database schemas. Each must implement and enforce a set of rules. Your design tables, their primary keys, and foreign keys to enforce each of the rules. Some tables may require an additional unique index. You are not required to populate these tables but you should try breaking some of the rules to ensure that you have implemented all the constraints. You must define these schemas in the database under the specified names. The score for each problem is the number of rules that the schema correctly enforces.
Create a database to keep track of each copy of a collection of book titles in your bookstore.
- Book titles are identified by their ISBN.
- Your store may have several copies under the same title.
Model cities, states, and capitals:
- Each city belongs to one state.
- Each state has one capital.
- A capital is a city.
- A capital must be in the same state.
Model a tennis club that has courts, members, and 1-hour reservations.
- The club has several courts identified by letters: A, B, C, D.
- The club has members identified by the phone numbers. Two members may have the same names.
- A member can reserve a court for a 1-hour session starting at the top of the hour.
- A member cannot reserve more than one court for the same hour.
- No two members can reserve the same court for the same hour.
Model the chess games between members of your chess clubs.
- Club members are identified by a 12-character nickname
- Each game has two players: one playing white and the other black.
- Each game has a start date/time and an end date/time.
- Each game also has one of four possible outcomes: white wins, black wins, draw, or aborted.
Create a database of users with their payment methods.
- Users are identified by their user names
- Users have names and emails; no two users can share the same email.
- User may have one or more payment methods.
- A payment method is identified by a 16-bit credit card number and has a requird expiration date.
- If a user has any payment methods, one them must be designated as the default payment methods. A user cannot have more than one default payment methods.
In a distopian universe, create a database of images and the identity of people recognized in each image.
- You have several security cameras labeled A, B, C, D.
- The cameras take pictures identified by their camera and a timestamp.
- You have a collection of people identified by their implanted RFID chip numbers. People have no names.
- Each person can have any any combination of the following skills: hunt, forage, and fight.
- For each image, the database identifies all the people who were recognized in it by the face recognition algorithm.