UNION, INTERSECT & EXCEPT · Question 1 · Easy

Table Cricket: student Aman Bina Chetan Bina Table Football: student Bina Divya Aman Which names does this query return?

SELECT student FROM Cricket
UNION
SELECT student FROM Football
ORDER BY student;
  1. Aman; Aman; Bina; Bina; Bina; Chetan; Divya
  2. Aman; Bina
  3. Aman; Bina; Bina; Chetan; Divya
  4. Aman; Bina; Chetan; Divya
Answer and explanation

Answer: D. Aman; Bina; Chetan; Divya

Explanation: UNION puts the rows of both queries together and then removes all duplicates, including the repeated Bina inside Cricket itself. Four different names remain.

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