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?

  1. Exactly n
  2. m + n
  3. Anything from m to m × n, depending on the data
  4. 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

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