Chapter 7. Retrieving Data From Multiple Tables
All the queries so far have retrieved rows from a single table. Now I’ll explain how to use joins to retrieve rows from multiple tables simultaneously. Recall from “Relationships” in Chapter 2 that a relationship is an association established between common columns in two tables. A join is a table operation that uses related columns to combine rows from two input tables into one result table. You can chain joins to retrieve rows from an unlimited number of tables.
Why do joins matter? The most important database information isn’t so much stored in the rows of individual tables; rather, it is the implied relationships between sets of related rows. In the sample database, for example, the individual ...
Get SQL: Visual QuickStart Guide 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.