UNION, INTERSECT & EXCEPT · Question 18 · Hard

UNION, INTERSECT & EXCEPT question 18

Table Cricket:
student
Aman
Bina
Chetan
Bina

Table Football:
student
Bina
Divya
Aman

The second SELECT has a WHERE clause. Which names does this query return?

SELECT student FROM Football
EXCEPT
SELECT student FROM Cricket WHERE student <> 'Bina'
ORDER BY student;
  1. Divya
  2. Bina; Divya
  3. Aman; Divya
  4. Aman; Bina; Divya
Answer and explanation

Answer: B. Bina; Divya

Explanation: The WHERE clause belongs only to the second SELECT, which therefore returns Aman and Chetan. Removing those from the football players Bina, Divya and Aman leaves Bina and Divya.

Previous: Table MayOrders: order_id | coupon 1 | SAVE10 2 | NULL 3 | NULL Table… · Next: 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

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