CS FundamentalsHardProduct placement · SQL round
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', 'N', 150), (6, 'Ira', 'N', 200), (7, 'Lal', NULL, 120). What does this query return?
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', 'N', 150), (6, 'Ira', 'N', 200), (7, 'Lal', NULL, 120).
What does this query return?
SELECT COUNT(*) FROM Sale
WHERE region NOT IN ('S', NULL);- A. 5
- B. 0
- C. 6
- D. 4
Correct answer: B. 0
region NOT IN ('S', NULL) means region <> 'S' AND region <> NULL; the second comparison is always UNKNOWN, so no row can be TRUE.
More DBMS and SQL questions
- TS(T1) = 15, TS(T2) = 30, TS(T3) = 25; all read/write timestamps start at 0. Under basic timestamp ordering with Thomas's write rule…
- Table Att(emp, day, status) rows: ('u', 1, 'P'), ('u', 2, 'P'), ('u', 3, 'A'), ('u', 4, 'P'), ('u', 5, 'P'), ('u', 6, 'P'), ('v', 1, 'A')…
- Which of the following is NOT one of the anomalies that normalisation into BCNF is meant to remove?
- Under the write-ahead logging (WAL) rule, which ordering must hold?
- A B+ tree index uses 2048-byte blocks, 14-byte search keys, 8-byte block (tree) pointers and 10-byte record pointers. What is the maximum…
- Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4…