UNION, INTERSECT & EXCEPT · Question 20 · Hard
Table Cricket: student Aman Bina Chetan Bina The same table is used on both sides of the UNION. How many rows does this query return?
SELECT student FROM Cricket
UNION
SELECT student FROM Cricket;
- 4 rows
- 8 rows
- 0 rows
- 3 rows
Answer and explanation
Answer: D. 3 rows
Explanation: UNION removes duplicates from the whole combined result, not only rows that come from different queries. The 8 combined rows contain just three distinct names: Aman, Bina and Chetan.
Previous: Tables A and B each have a column id that is declared NOT NULL. A.id can…
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
- Table MayOrders: order_id | coupon 1 | SAVE10 2 | NULL 3 | NULL Table…
- Table Cricket: student Aman Bina Chetan Bina Table Football: student Bina…
- Tables A and B each have a column id that is declared NOT NULL. A.id can…
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