Exercise Monday

Now, let's go through some exercises to help you get comfortable with database design and schemas:

  • Create tables with sample data for a system that tracks non-profits and their board members. A non-profit has many board members, so this is a one-to-many relationship. Sketch it out on a whiteboard, or using a spreadsheet.
  • Suppose you wanted to make a list of restaurants in your neighborhood and group them together by the kind of food they serve. Create sample restaurants and types_of_food tables. Start with a one-to-many relationship (assume a restaurant only serves one type of food) and then change it to a many-to-many.
  • Make up some bus lines and bus stops. This is a many-to-many relationship: a bus line has many stops, and a stop can have many lines that go through it. Create a join table to show which lines go to which stops.
  • Make a schema for your database tables of restaurants and the type of food they serve.
  • Make a database schema for the bus lines and bus stops you designed.