CS FundamentalsHardProduct-company placement
Player(pid, team, runs) has rows (1, 'A', 50), (2, 'A', 70), (3, 'A', 70), (4, 'B', 40), (5, 'B', NULL), (6, 'B', 90), (7, 'C', NULL). What does this return? SELECT team, MAX(runs) FROM Player GROUP BY team HAVING COUNT(runs) < COUNT(*);
- A. Two rows: (B, 90) and (C, NULL)
- B. One row: (B, 90)
- C. Two rows: (B, NULL) and (C, NULL)
- D. No rows
Correct answer: A. Two rows: (B, 90) and (C, NULL)
COUNT(runs) skips NULLs, so the condition picks teams with at least one NULL: B (2 < 3) and C (0 < 1). MAX ignores NULLs, giving 90 for B and NULL for C, whose only value is NULL.
More DBMS and SQL questions
- Cust(cid, city) has rows (1, 'Pune'), (2, 'Delhi'), (3, NULL), (4, 'Pune'). What are the values of Q1: SELECT COUNT() FROM (SELECT city…
- Ord(oid, cid, amt) has no row with cid = 99. What do these return? Q1: SELECT SUM(amt), COUNT() FROM Ord WHERE cid = 99; Q2: SELECT cid…
- R(A, B, C, D, E, F) has functional dependencies AB → C, C → D, D → E, E → A and F → B. How many superkeys does R have?
- R(A, B, C, D, E, F) has functional dependencies A → BC, CD → E, E → A and B → F. It is decomposed into R1(A, B, C, F) and R2(A, C, D, E)…
- R(A, B, C, D, E) has functional dependencies A → C, B → D and CD → E. It is decomposed into R1(A, C), R2(B, D) and R3(A, B, E). Is the…
- R(A, B, C, D, E) has functional dependencies AB → CDE, C → A and D → E. What is the highest normal form R satisfies?