Lesson Weekend

Here are a few things to consider when we make and name our new databases and tables.

  • All names (databases, tables, columns, etc) should be in lowercase.

  • Table names should be plural; for example, tasks not task.

  • Names with multiple words are separated by an underscore. For example: date_of_birth not dateofbirth.

  • If a join table doesn't have any meaning besides just joining two tables, use table_name1_table_name2, with the names in alphabetical order. Example: cuisines_restaurants would be a join table for the table cuisines and restaurants.

  • If the table has meaning besides just joining the table, use a name that describes the relationship. Example: visits would be a good name for a join table that joins together a table called people and a table called places.

  • If you add in a foreign key to your table (i.e. the column list_id into the tasks table), the foreign key is a singularized version of the table it represents. For example, list_id not lists_id.