CS FundamentalsVery hardGATE CS (PYQ pattern)
VW(id, v): (1,5), (2,15), (3,25) and the view BIG = SELECT id, v FROM VW WHERE v > 10. Two more rows (4,8) and (5,30) are then inserted directly into VW. How many rows does SELECT * FROM BIG return afterwards?
- A. 2
- B. 4
- C. 5
- D. 3
Correct answer: D. 3
A view is a stored query, not a copy: it is evaluated on the current VW rows, so BIG shows ids 2, 3 and 5 (values 15, 25, 30): 3 rows.
More DBMS and SQL questions
- Relation R(A, B) has 6 tuples with 4 distinct values of A and 5 distinct values of B. What are the minimum and maximum possible…
- Relations R and S have 40 and 60 tuples (union-compatible). What are the minimum and maximum cardinalities of R ∪ S, R ∩ S and R − S (in…
- R(A, B) has 1000 tuples; S(B, C) has 500 tuples with B a key of S; T(C, D) has 200 tuples with C a key of T, and S.C is a NOT NULL foreign…
- The tuple calculus expression { t | ¬ Student(t) } over a database with a Student relation: is it safe, and why?
- A table is stored sorted on key K in 5000 pages (100 records each). Searching for one key with binary search over pages costs ceil(log2…
- A secondary dense index on a non-key attribute of a file with 1,000,000 records uses 4096-byte pages, 12-byte key + 8-byte pointer entries…