First Normal Form

The general concept of normalization includes several “normal forms.” An entity is said to be in the first normal form (1NF) when all attributes are single valued. To apply 1NF to an entity, we have to verify that each attribute in the entity has a single value for each instance of the entity. If any attribute has repeating values, it is not in 1NF.

A quick look back at our database reveals that we have repeating values in the Songs attribute, so the CD is clearly not in 1NF. An entity with repeating values indicates that we have missed at least one other entity. One way to discover missing entities is to look at each attribute and ask the question “What thing does this describe?”

What does Songs describe? It lists the songs on the CD. So a song is another “thing” that we capture data about and is probably an entity. We will add it to our diagram and give it a Song Name attribute. To complete the Song entity, we need to ask if there is more about a Song that we would like to capture. Earlier, we identified song length as something we might want to capture, so let’s add it. Figure 7-3 shows the new data model.

A data model with CD and Song entities
Figure 7-3. A data model with CD and Song entities

Now that Song Name and Song Length are attributes in a Song entity, we have a data model with two entities in 1NF. None of their attributes contain multiple values. Unfortunately, we have not shown any way ...

Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.