Uses for INNER JOINs

Now that you have a basic understanding of the mechanics for constructing an INNER JOIN, let’s look at some of the types of problems you can solve with it.

Find Related Rows

As you know, the most common use for an INNER JOIN is to link tables so that you can fetch columns from different tables that are related. Following is a sample list of the kinds of requests you can solve from the sample databases using an INNER JOIN.

“Show me the vendors and the products they supply to us.”

“List employees and the customers for whom they booked an order.”

“Display agents and the engagement dates they booked.”

“List customers and the entertainers they booked.”

“Find the entertainers who played engagements for customers Berg or Hallmark.” ...

Get SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, Second 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.