5 Joining Database Tables

A SQL query walks into a bar, approaches two tables, and asks, “May I join you?”

—The worst database joke in history

Now that you’ve learned how to use SQL to select and filter data from a table, you’ll see how to join database tables. Joining tables means selecting data from more than one table and combining it in a single result set. MySQL provides syntax to do different types of joins, like inner joins and outer joins. In this chapter, you’ll look at how to use each type.

Selecting Data from Multiple Tables

The data you want to retrieve from a database often will be stored in more than one table, and you need ...

Get MySQL Crash Course 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.