Associating Data from Separate Tables

Joins are necessary in a relational database management system because the relational model's data independence permits you to bring data from separate tables into new and unanticipated relationships. Relationships among data values become explicit when the data is manipulated—when you query the database, not when you create it.

You need not know in advance that data will join. You can discover new relationships among data in different tables by joining them. For example, you could use a join to find out whether any editor is also an author. Figure 7.1 shows two versions of the join; they differ only in syntax—more on this later.

Figure 7.1. Comparing Join Queries

This query is a little tricky. Because an ...

Get Practical SQL Handbook, The: Using SQL Variants, Fourth 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.