Denormalize Data—When Does It Make Sense to Break the Rules?

Consider the case of the city, state, and citystatezip tables. On one hand, these tables conform to the third normal form. On the other hand, every time you need to write a query to extract customer data, you will need to join data from four tables. Whenever you normalize data, you always have to balance the competing goals of reducing data redundancy with the extra work that will be created when needing to extract data from the database. Most of the time, elements like city, state, and ZIP Code are carried redundantly. Consider the case of trying to assign a city to a customer but the city has not been defined in the city table. You need to maintain the city table first. Now, what ...

Get Absolute Beginner’s Guide to Databases 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.