CS FundamentalsModerateGATE CS · SQL
Table Product(pid, cat, price) rows: (1, 'X', 10), (2, 'X', 20), (3, 'Y', 20), (4, NULL, 30), (5, 'Y', NULL), (6, 'Z', 5). What does this query return?
Table Product(pid, cat, price) rows: (1, 'X', 10), (2, 'X', 20), (3, 'Y', 20), (4, NULL, 30), (5, 'Y', NULL), (6, 'Z', 5).
What does this query return?
SELECT pid FROM Product WHERE price IS NOT NULL ORDER BY price DESC, pid LIMIT 2 OFFSET 1;
- A. 2, 3
- B. 2, 1
- C. 3, 1
- D. 4, 2
Correct answer: A. 2, 3
Sorted by price desc then pid: 4 (30), 2 (20), 3 (20), 1 (10), 6 (5). Skip one row and take two: 2, 3.
More DBMS and SQL questions
- A B+ tree has at most 21 children per internal node and at most 20 keys per leaf. A non-root internal node must have at least ⌈21/2⌉…
- R(A, B, C, D, E) with functional dependencies B → A, E → D, D → C is decomposed into R1(A, B), R2(A, C), R3(C, D, E). Which statement is…
- Classify the schedule R3(A), W1(B), R1(A), R3(B), W2(B), R2(A), R2(B), W3(B).
- R(A, B, C, D, E, F) has functional dependencies F → AB, D → C, C → F, CE → D. How many superkeys does R have?
- R(A, B, C, D, E) has the set of functional dependencies Σ = {E → AC, C → B, AE → B, A → D}. Which of the following FDs is NOT in Σ⁺ (not…
- Table Sale(id, rep, region, amt) rows: (1, 'Ira', 'N', 100), (2, 'Jai', 'S', 250), (3, 'Ira', 'S', NULL), (4, 'Kim', 'N', 300), (5, 'Jai'…