UNION, INTERSECT & EXCEPT · Question 2 · Easy

Table Cricket: student Aman Bina Chetan Bina Table Football: student Bina Divya Aman How many rows does this query return?

SELECT student FROM Cricket
UNION ALL
SELECT student FROM Football;
  1. 4 rows
  2. 7 rows
  3. 6 rows
  4. 5 rows
Answer and explanation

Answer: B. 7 rows

Explanation: UNION ALL simply appends the second result to the first and removes nothing. Cricket has 4 rows and Football has 3, so 4 + 3 = 7 rows come back.

Previous: Table Cricket: student Aman Bina Chetan Bina Table Football: student Bina… · Next: Table Cricket: student Aman Bina Chetan Bina Table Football: student Bina…

Practise union, intersect & except

Try a fresh set of union, intersect & except questions with an explanation after every answer, free and without signing up: UNION, INTERSECT & EXCEPT practice. Or sit a full placement mock test.

More union, intersect & except questions

More sql practice

Tables, Keys & Constraints · DML & Transactions · SELECT, WHERE & ORDER BY · SQL Joins · Aggregates & GROUP BY · Subqueries & CTEs · Window Functions · NULL Handling

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge