CS FundamentalsModerateGATE CS
A(x) holds 1, 2, 2, 3 and B(x) holds 2, 3, 3, 4. How many rows does SELECT x FROM A UNION SELECT x FROM B return?
- A. 4
- B. 8
- C. 6
- D. 5
Correct answer: A. 4
UNION removes duplicates, leaving the distinct values 1, 2, 3, 4. UNION ALL would give 8 rows.
More DBMS and SQL questions
- R(A, B, C) has the functional dependencies AB -> C and C -> B. Which is the highest normal form that R satisfies?
- T(v) holds 40, 10, 30, 20, 50. What does SELECT v FROM T ORDER BY v DESC LIMIT 2 OFFSET 1 return, in order?
- T(x) holds 10, NULL, 20, 30, NULL. What does SELECT AVG(x) FROM T return?
- A bank's server crashes immediately after a transaction commits, before its changes are written to the data files. After restart the…
- Sc(n, s) holds (a, 90), (b, 85), (c, 85), (d, 80), (e, 70). For the row of n = 'd', what are RANK() OVER (ORDER BY s DESC) and DENSERANK()…
- E(n, dept, sal) holds (a, x, 50), (b, x, 70), (c, x, 60), (d, y, 40), (e, y, 40), (f, z, 90). How many rows does SELECT n FROM E e1 WHERE…