UNION, INTERSECT & EXCEPT · Question 13 · Medium
UNION, INTERSECT & EXCEPT question 13
Table Cricket:
student
Aman
Bina
Chetan
Bina
Table Football:
student
Bina
Divya
Aman
The INTERSECT of the two tables on student returns 2 rows (Aman and Bina). What does this join version return?
SELECT COUNT(*)
FROM Cricket c
JOIN Football f ON c.student = f.student;
- 2
- 4
- 3
- 12
Answer and explanation
Answer: C. 3
Explanation: A join pairs every matching combination and does not remove duplicates. Aman matches once, and each of the two Bina rows in Cricket matches the one Bina row in Football, giving 1 + 2 = 3. A join equals INTERSECT only if DISTINCT is added.
Previous: Table Cricket: student Aman Bina Chetan Bina Table Football: student Bina… · Next: Table SectionA: name | marks Gita | 70 Hari | 90 Table SectionB: name | marks…
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 SectionA: name | marks Gita | 70 Hari | 90 Table SectionB: name | marks…
- Table Store: city | product Pune | Pen Pune | Ink Table Depot: city | product…
- Table Cricket: student Aman Bina Chetan Bina Table Football: student Bina…
- Table SectionA: name | marks Gita | 70 Hari | 90 Table SectionB: name | marks…
- 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