Simple JOINs

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/10

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:30 PM on 9/30/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

11 Terms

1
New cards

INNER JOIN

Returns only rows with a match in both tables. Example: Person INNER JOIN Dog returns owners who have dogs and dogs with owners.

2
New cards

INNER JOIN syntax

SELECT p.PersonName, d.DogName FROM Person p INNER JOIN Dog d ON p.PersonID = d.OwnerID;

3
New cards

JOIN vs. INNER JOIN

JOIN usually means INNER JOIN. Example: FROM Orders o JOIN Customers c ON o.CustomerID = c.CustomerID;

4
New cards

LEFT JOIN

Keeps every row from the table on the left, plus matches from the right. Missing matches show NULL.

5
New cards

LEFT JOIN example

SELECT p.PersonName, d.DogName FROM Person p LEFT JOIN Dog d ON p.PersonID = d.OwnerID; Includes people without dogs.

6
New cards

RIGHT JOIN

Keeps every row from the table on the right, plus matches from the left. Example: Person RIGHT JOIN Dog includes dogs without owners.

7
New cards

LEFT JOIN vs. RIGHT JOIN

A RIGHT JOIN can usually be rewritten as a LEFT JOIN by switching table order. Example: Dog LEFT JOIN Person preserves all dogs.

8
New cards

CROSS JOIN

Returns every possible combination of rows; it does not use ON. Example: 6 people × 7 dogs = 42 rows.

9
New cards

FULL OUTER JOIN

Returns all rows from both tables; unmatched values are NULL. Example: includes both a dog with no owner and a person with no dog.

10
New cards

IS NULL with a JOIN

Use WHERE right_table.key IS NULL to find unmatched left-table rows. Example: people with no dogs: WHERE d.OwnerID IS NULL.

11
New cards

One-to-many JOIN result

One person with 2 dogs appears in 2 result rows—one row for each dog. Example: Laura + Jack and Laura + Bandit.