0
0
MySQLquery~5 mins

INNER JOIN in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does an INNER JOIN do in SQL?
An INNER JOIN returns only the rows where there is a match in both tables based on the join condition.
Click to reveal answer
beginner
Write the basic syntax of an INNER JOIN between two tables table1 and table2 on column id.
SELECT * FROM table1 INNER JOIN table2 ON table1.id = table2.id;
Click to reveal answer
beginner
If a row in table1 has no matching row in table2, will it appear in the INNER JOIN result?
No, only rows with matching values in both tables appear in the INNER JOIN result.
Click to reveal answer
intermediate
How is INNER JOIN different from LEFT JOIN?
INNER JOIN returns only matching rows in 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
intermediate
Can you use INNER JOIN to join more than two tables?
Yes, you can chain multiple INNER JOINs to combine more than two tables by specifying join conditions for each pair.
Click to reveal answer
What rows does an INNER JOIN return?
AOnly rows with matching values in both tables
BAll rows from the left table
CAll rows from the right table
DAll rows from both tables
Which keyword can replace INNER JOIN and produce the same result?
AOUTER JOIN
BLEFT JOIN
CJOIN
DCROSS JOIN
What happens if there is no matching row in the second table for INNER JOIN?
AThe row is excluded from the result
BThe row is duplicated
CAn error occurs
DThe row from the first table is included with NULLs
Which clause specifies the condition for an INNER JOIN?
AWHERE
BON
CGROUP BY
DHAVING
Can INNER JOIN be used to join tables on multiple columns?
AOnly with subqueries
BNo, only one column can be used
COnly with UNION
DYes, by specifying multiple conditions in ON
Explain in your own words what an INNER JOIN does and when you would use it.
Think about matching pairs in two lists.
You got /4 concepts.
    Describe the difference between INNER JOIN and LEFT JOIN with an example scenario.
    Imagine a guest list and RSVP responses.
    You got /4 concepts.