CS FundamentalsModerateProduct placement · SQL round
Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4, 'Dev', 'Tech', NULL, 3), (5, 'Esha', NULL, 35, 3), (6, 'Farid', 'Tech', 70, 2). What does this query return?
Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4, 'Dev', 'Tech', NULL, 3), (5, 'Esha', NULL, 35, 3), (6, 'Farid', 'Tech', 70, 2).
What does this query return?
SELECT COUNT(*) FROM Staff WHERE name LIKE '_a%';
- A. 2
- B. 3
- C. 1
- D. 4
Correct answer: A. 2
'_' matches exactly one character, then 'a', then anything: Bala and Farid have 'a' as the second letter.
More DBMS and SQL questions
- For the schedule W3(A), W3(C), R2(A), R1(A), W1(B), W4(A), R2(C), W4(B), how many serial schedules of T1–T4 are conflict-equivalent to it?
- R(A, B, C, D, E, F) has functional dependencies EF → D, A → C, BE → F, F → A, DF → A. What is the highest normal form R satisfies?
- Table Sale(id, rep, region, amt) rows: (1, 'Ira', 'N', 100), (2, 'Jai', 'S', 250), (3, 'Ira', 'S', NULL), (4, 'Kim', 'N', 300), (5, 'Jai'…
- Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4…
- A file has 30,000 records of 120 bytes, stored unspanned in 1024-byte blocks and ordered on key K. A primary (sparse) index on K has one…
- Classify the schedule R3(B), W1(A), R3(A), W1(B), W2(B), R2(B), C2, W3(B), R1(A), C3, C1 (Ci = commit of Ti) by the strongest property it…