Join

The join operation works on two or more tables at a time, combining the data so that you can compare and contrast information in your database. The join operation gives SQL and the relational model a good deal of their power and flexibility. You can find any relationship that exists among data elements, not just the relationships you anticipated when you designed your database.

When you “join” two tables, it's as if you're melding them together for the duration of the query. The join operation combines data by comparing values in specified columns and displaying the results.

The easiest way to understand the join operation is with an example. Let's suppose you want to know the names and publishers of all the books in the database. The name ...

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.