CS FundamentalsModerateProduct placement · SQL round
Table P(x) rows: (1), (2), (2), (3), (NULL). Table Q(x) rows: (2), (3), (3), (NULL), (4). What does this query return?
Table P(x) rows: (1), (2), (2), (3), (NULL).
Table Q(x) rows: (2), (3), (3), (NULL), (4).
What does this query return?
SELECT COUNT(*) FROM P JOIN Q ON P.x = Q.x;
- A. 4
- B. 5
- C. 3
- D. 2
Correct answer: A. 4
Join pairs: P's two 2s each match Q's single 2 (2 pairs); P's 3 matches Q's two 3s (2 pairs). NULLs never satisfy '=', so 4.
More DBMS and SQL questions
- R has 500 tuples in 50 blocks and S has 4000 tuples in 200 blocks. With only enough memory for one block of each relation, how many block…
- Under BOTH wait-die and wound-wait deadlock prevention, which transaction can be rolled back when a lock conflict occurs?
- Table Acct(no, branch, bal) rows: (101, 'Agra', 500), (102, 'Agra', 1500), (103, 'Bhopal', 700), (104, 'Bhopal', 700), (105, 'Cuttack'…
- R(A, B, C, D, E, F) with functional dependencies E → B, F → A, B → A, C → E is decomposed into R1(A, B, F), R2(B, D, E), R3(C, E). Which…
- On R(A, B, C, D, E), F = {AB → C, DE → C, B → C} and G = {B → DE, E → AC, D → A}. Which statement is correct? ("F covers G" means every FD…
- R(A, B, C, D, E, F) has FDs E → AB, C → A, DE → AB, B → EF. Each option is a relation schema obtained by projecting R, with the…