CS FundamentalsModerateGATE CS (PYQ pattern)
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 key referencing T. R.B is not a foreign key. What are the minimum and maximum possible sizes of R join S join T (natural joins)?
- A. 0 to 1000
- B. exactly 1000
- C. 0 to 500
- D. 0 to 100,000,000
Correct answer: A. 0 to 1000
S join T has exactly 500 tuples (each S row finds its one T row). Joining R on B, each R row matches at most one S row (B is a key of S), so at most 1000; since R.B need not exist in S, the minimum is 0. 'Exactly 1000' would need R.B to be a NOT NULL foreign key.
More DBMS and SQL questions
- 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…
- A table of 1,000,000 rows (100 rows per page, 10,000 pages) is clustered on A, with a B+ tree whose leaves hold 200 entries each; reaching…
- Sort-merge join of R (200 pages) and S (100 pages) with 15 buffer pages: each relation is fully sorted by external merge sort (pass 0…
- Under the deferred database modification scheme with a log, a crash occurs. The log holds <T1 start>, <T1,A,5>, <T1 commit>, <T2 start>…