O'Reilly logo

Discovering SQL: A Hands-On Guide for Beginners by Alex Kriegel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7

You Broke It; You Fix It: Combining Data Sets

Let us recall from Chapter 3 that normalization of a relational database is the process of arranging the data with maximum precision and minimum duplication. This is largely achieved by establishing relationships between several tables that contain data. The relationships are established through the use of special values, called keys, which are unique to every record in the entire database.

images Formal terminology of the relational theory could be quite confusing. Throughout the book I use friendly terms such as table, row, (record) and column, while the corresponding formal terms would be relation, tuple, and attribute.

This approach is good for maintaining data and minimizing inconsistencies, but it is not exactly user-friendly when it actually comes to using data. A cook would normally have all the ingredients lined up before she embarks on creating a dish, and then combining them according to certain rules. A user of the database must do something similar: Figure out the blocks of the data she wants to access and then fetch all the necessary data from various tables into one temporary structure, or data set. This is a job for the JOIN keyword, briefly touched on in early chapters.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required