What does an SQL JOIN do?
A
Deletes data from multiple tables B
Combines rows from two or more tables based on related columns C
Creates a new table D
Sorts data
Analysis & Theory
A JOIN combines rows where specified conditions between tables match.
Which JOIN returns only matching rows from both tables?
A
LEFT JOIN B
RIGHT JOIN C
INNER JOIN D
FULL OUTER JOIN
Analysis & Theory
INNER JOIN returns rows with matching values in both tables.
Which JOIN returns all rows from the left table and matching rows from the right?
A
LEFT JOIN B
RIGHT JOIN C
INNER JOIN D
CROSS JOIN
Analysis & Theory
LEFT JOIN returns all records from the left table and matches from the right.
What does a FULL OUTER JOIN return?
A
Only rows with matches in both tables B
All rows from the right table C
All rows when there is a match in one of the tables D
Duplicates rows
Analysis & Theory
FULL OUTER JOIN returns all rows when there is a match in either table.
Which JOIN returns a Cartesian product of the two tables?
A
INNER JOIN B
OUTER JOIN C
CROSS JOIN D
LEFT JOIN
Analysis & Theory
CROSS JOIN pairs every row from the first table with every row of the second.
Which keyword is used to specify a JOIN condition?
A
USING B
WHERE C
ON D
HAVING
Analysis & Theory
ON specifies the condition for joining tables.
What will this query do?
SELECT * FROM A LEFT JOIN B ON A.id = B.a_id;
A
Return only matching rows B
Return all rows from A and matching rows from B C
Return all rows from B D
Return only rows where A.id is NULL
Analysis & Theory
LEFT JOIN keeps all rows from table A.
Which JOIN includes unmatched rows from the right table with NULLs for the left table?
A
LEFT JOIN B
RIGHT JOIN C
INNER JOIN D
SELF JOIN
Analysis & Theory
RIGHT JOIN includes all rows from the right table.
Which JOIN is used to join a table with itself?
A
CROSS JOIN B
OUTER JOIN C
SELF JOIN D
EQUI JOIN
Analysis & Theory
A SELF JOIN joins a table to itself.
What does an INNER JOIN without an ON condition do?
A
Gives an error B
Returns a Cartesian product C
Returns only NULLs D
Returns zero rows
Analysis & Theory
An INNER JOIN without ON acts like a CROSS JOIN.