Understanding the most important database design principles
In general, when designing a database structure, you want it to be normalized. Very briefly, here are the basic rules regarding data normalization:
- Each row can be uniquely referenced by a single column or combination of columns (that is, always have a primary key).
- Each column should contain a single value, not a collection of values (that is, avoid columns such as
artist_names
that contain column-separated names of multiple artists). - Each column should contain different data than contained in other columns (that is, avoid columns such as
artist_name_1
,artist_name_2
, and so on). - Each column in the table is only dependent on the primary key, and not dependent on another column (that is, avoid an
artist_name
andartist_country
column in atracks
table).
There are a lot of books that cover database normalization. Please see the Further reading section at the end of the chapter for some examples. In...