SQL Joins · Question 3 · Easy

Table Colours: colour Red Blue Green Table Sizes: size S M How many rows does this query return?

SELECT c.colour, s.size
FROM Colours c
CROSS JOIN Sizes s
WHERE c.colour <> 'Red';
  1. 2 rows
  2. 3 rows
  3. 4 rows
  4. 6 rows
Answer and explanation

Answer: C. 4 rows

Explanation: The cross join pairs every colour with every size: 3 × 2 = 6 rows. WHERE then removes the two Red rows, leaving 4.

Previous: Table Teams: team_id | team | city 1 | CSK | Chennai 2 | MI | Mumbai 3 | RCB |… · Next: In A LEFT JOIN B, what happens to a row of A that has no matching row in B?

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