UNION, INTERSECT & EXCEPT · Question 14 · Medium
Table SectionA: name | marks Gita | 70 Hari | 90 Table SectionB: name | marks Isha | 80 Jay | 60 Which names does this query return?
SELECT name FROM SectionA WHERE marks > 75
UNION
SELECT name FROM SectionB WHERE marks > 75
ORDER BY name;
- Hari; Isha
- Gita; Hari; Isha
- Hari
- Gita; Hari; Isha; Jay
Answer and explanation
Answer: A. Hari; Isha
Explanation: Each WHERE belongs to its own SELECT and filters that table before the UNION. SectionA contributes Hari (90) and SectionB contributes Isha (80); Gita (70) and Jay (60) fail the filter.
Previous: Table Cricket: student Aman Bina Chetan Bina Table Football: student Bina… · Next: Table Customer(cust_id, name) has 5 rows and table Supplier(supp_id, name) has…
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 Store: city | product Pune | Pen Pune | Ink Table Depot: city | product…
- Table Cricket: student Aman Bina Chetan Bina Table Football: student Bina…
- Table Cricket: student Aman Bina Chetan Bina Table Football: student Bina…
- Table Customer(cust_id, name) has 5 rows and table Supplier(supp_id, name) has…
- Table Cricket: student Aman Bina Chetan Bina Table Football: student Bina…
- 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…
- Table Cricket: student Aman Bina Chetan Bina The same table is used on both…
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