CS FundamentalsHardGATE CS · SQL
Table Score(name, pts) rows: ('a', 90), ('b', 85), ('c', 90), ('d', 70), ('e', 85), ('f', 60). What does this query return?
Table Score(name, pts) rows: ('a', 90), ('b', 85), ('c', 90), ('d', 70), ('e', 85), ('f', 60).
What does this query return?
SELECT COUNT(*) FROM Score a JOIN Score b ON a.pts < b.pts;
- A. 15
- B. 10
- C. 13
- D. 12
Correct answer: C. 13
Scores: 90, 90, 85, 85, 70, 60. 60 is below 5 others, 70 below 4, each 85 below 2 (the 90s), and each 90 below none: 5 + 4 + 2 + 2 = 13. Equal scores form no pair.
More DBMS and SQL questions
- Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4…
- R(A, B, C, D, E) with functional dependencies BE → A, C → AD, D → C is decomposed into R1(C, E), R2(A, D, E), R3(A, B, E). Which statement…
- Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4…
- A B+ tree index uses 8192-byte blocks, 24-byte search keys, 10-byte block pointers and 16-byte record (data) pointers. Each leaf also…
- R has 1600 tuples in 80 blocks and S has 20000 tuples in 500 blocks. With only enough memory for one block of each relation, how many…
- Classify the schedule R1(A), W2(B), W1(A), R2(B), W1(B), W2(A), R3(A), W3(B), W3(A).