CS FundamentalsModerateTCS Digital · Infosys SP · GATE CS
Table Takes(sid, cid, marks) rows: (1, 'C1', 80), (1, 'C2', NULL), (2, 'C1', 65), (3, 'C2', 90), (3, 'C3', 75), (5, 'C1', 50). What does this query return?
Table Takes(sid, cid, marks) rows: (1, 'C1', 80), (1, 'C2', NULL), (2, 'C1', 65), (3, 'C2', 90), (3, 'C3', 75), (5, 'C1', 50).
What does this query return?
SELECT AVG(c) FROM (SELECT COUNT(*) AS c FROM Takes GROUP BY sid);
- A. 1.2
- B. 1.5
- C. 1.25
- D. 2
Correct answer: B. 1.5
Courses per sid: 1 → 2, 2 → 1, 3 → 2, 5 → 1. The average of these four counts is 6/4 = 1.5.
More DBMS and SQL questions
- R(A, B, C, D, E, F) has FDs A → BCE, C → ABD, DF → BE. Each option is a relation schema obtained by projecting R, with the dependencies…
- For the schedule W4(B), R1(B), R2(A), R1(C), R3(B), R4(A), R3(C), W2(C), how many serial schedules of T1–T4 are conflict-equivalent to it?
- For the schedule R1(B), W1(B), R2(C), W3(C), R3(B), R4(B), R2(B), R4(A), how many serial schedules of T1–T4 are conflict-equivalent to it?
- Assertion (A): A schedule produced under the basic timestamp-ordering protocol with Thomas's write rule is always conflict serializable…
- Table Stu(sid, sname) rows: (1, 'Om'), (2, 'Pia'), (3, 'Raj'), (4, 'Sia'). Table Takes(sid, cid, marks) rows: (1, 'C1', 80), (1, 'C2'…
- Keys 7, 53, 17, 43, 38, 5, 27, 50, 47, 10 are inserted in this order into an empty B+ tree where a node holds at most 3 keys; an…