Recall & Review
beginner
What does INNER JOIN do in SQL?
INNER JOIN combines rows from two tables where the join condition is true, returning only matching rows.
Click to reveal answer
beginner
Write the basic syntax of an INNER JOIN between two tables
table1 and table2 on a common column id.SELECT * FROM table1 INNER JOIN table2 ON table1.id = table2.id;
Click to reveal answer
beginner
Can INNER JOIN return rows where there is no match in the other table?
No, INNER JOIN only returns rows where there is a match in both tables based on the join condition.
Click to reveal answer
intermediate
What happens if you omit the ON clause in an INNER JOIN?
Omitting the ON clause causes a syntax error because the join condition is required to match rows.
Click to reveal answer
intermediate
How is INNER JOIN different from LEFT JOIN?
INNER JOIN returns only matching rows from both tables, while LEFT JOIN returns all rows from the left table and matching rows from the right table (or NULL if no match).
Click to reveal answer
What does INNER JOIN return?
✗ Incorrect
INNER JOIN returns only rows where the join condition matches in both tables.
Which keyword is mandatory in an INNER JOIN to specify how tables are matched?
✗ Incorrect
The ON clause specifies the join condition for INNER JOIN.
What happens if there is no matching row in the second table for an INNER JOIN?
✗ Incorrect
INNER JOIN excludes rows without matches in the other table.
Which SQL clause can be used as a shorthand for INNER JOIN when joining on columns with the same name?
✗ Incorrect
USING can be used to join tables on columns with the same name.
Which of the following is a valid INNER JOIN syntax?
✗ Incorrect
Option A is the correct syntax with INNER JOIN and ON clause.
Explain how INNER JOIN works and write a simple query joining two tables on a common column.
Think about matching rows in two lists and how you combine them.
You got /3 concepts.
Describe the difference between INNER JOIN and LEFT JOIN with an example scenario.
Imagine two lists of friends and which friends appear in both or only one list.
You got /3 concepts.