Rules for Table Layout

There can be more than one correct solution, but any correct solution will tend to respect the following principles:

  • each table has a primary key
  • no redundant data is present when considering all tables as a whole
  • all columns in a table depend directly upon all segments of the primary key

These principles will be studied in details in the following sections.

Primary Keys and Table Names

Let's start by defining the concept of a unique key. A column on which a unique key is defined cannot hold the same value more than once for this table. The primary key is composed of one or more columns, it is a value that can be used to identify a unique row in a table. Why do we need a primary key? MySQL itself does not force us to have a primary ...

Get Creating your MySQL Database: Practical Design Tips and Techniques now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.