SQL Joins · Question 20 · Hard
Table A has m rows. Table B has n rows and B.k is its primary key. How many rows does A LEFT JOIN B ON A.k = B.k return?
- Exactly n
- m + n
- Anything from m to m × n, depending on the data
- Exactly m
Answer and explanation
Answer: D. Exactly m
Explanation: Because B.k is unique, a row of A can match at most one row of B, so no A row is duplicated. The left join also keeps the A rows that match nothing, so the result has exactly m rows.
Previous: Table Staff: emp_id | name | manager_id 1 | Nandini | NULL 2 | Omkar | 1 3 |…
Practise sql joins
Try a fresh set of sql joins questions with an explanation after every answer, free and without signing up: SQL Joins practice. Or sit a full placement mock test.
More sql joins questions
- Table Riders: rider_id | name 1 | Manoj 2 | Nisha 3 | Om Table Trips: trip_id…
- Table Invoices: inv_id | customer | total 1 | Zoya | 1000 2 | Arun | 500 Table…
- Table Staff: emp_id | name | manager_id 1 | Nandini | NULL 2 | Omkar | 1 3 |…
More sql practice
Aggregates & GROUP BY · Subqueries & CTEs · Window Functions · NULL Handling · SQL Functions & CASE · UNION, INTERSECT & EXCEPT · Tables, Keys & Constraints · DML & Transactions
LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge