UNION, INTERSECT & EXCEPT · Question 15 · Medium
UNION, INTERSECT & EXCEPT question 15
Table Customer(cust_id, name) has 5 rows and table Supplier(supp_id, name) has 3 rows. How does the shape of SELECT name FROM Customer UNION ALL SELECT name FROM Supplier differ from that of Customer CROSS JOIN Supplier?
- The UNION ALL has 2 columns and 8 rows; the cross join has 4 columns and 8 rows
- The UNION ALL has 1 column and 15 rows; the cross join has 4 columns and 8 rows
- Both have 1 column and 8 rows
- The UNION ALL has 1 column and 8 rows; the cross join has 4 columns and 15 rows
Answer and explanation
Answer: D. The UNION ALL has 1 column and 8 rows; the cross join has 4 columns and 15 rows
Explanation: A set operator stacks results vertically: the column count stays 1 and the rows add up to 5 + 3 = 8. A join places tables side by side: the columns add up to 2 + 2 = 4 and a cross join has 5 x 3 = 15 rows.
Previous: Table SectionA: name | marks Gita | 70 Hari | 90 Table SectionB: name | marks… · 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
- Table Cricket: student Aman Bina Chetan Bina Table Football: student Bina…
- Table Cricket: student Aman Bina Chetan Bina Table Football: student Bina…
- Table SectionA: name | marks Gita | 70 Hari | 90 Table SectionB: name | marks…
- 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