CS FundamentalsModerateProduct-company MCQ pattern
Assertion (A): In SQL, `WHERE dept = NULL` returns no rows even when dept contains NULL values. Reason (R): A comparison with NULL using = evaluates to UNKNOWN, and WHERE keeps only rows for which the condition is TRUE.
- A. Both A and R are true, and R explains A
- B. Both A and R are true, but R does not explain A
- C. A is true, R is false
- D. A is false, R is true
Correct answer: A. Both A and R are true, and R explains A
NULL = NULL is UNKNOWN, not TRUE, so no row passes. The right test is dept IS NULL. GROUP BY, DISTINCT and set operators are the places where NULLs are treated as equal.
More DBMS and SQL questions
- How many of the following statements are correct? 1. A phantom read occurs when re-running a query with the same predicate returns new…
- Match each concept with its description: (P) Partial dependency (Q) Transitive dependency (R) BCNF violation (S) Multivalued dependency…
- How many of the following statements about indexing are correct? 1. A B+ tree stores data pointers only in its leaves, which are linked…
- A relation is in 2NF, but a non-key attribute depends on another non-key attribute (a transitive dependency on the key). Which normal form…
- Which SQL command removes a table completely — its rows, its structure and its definition in the catalogue?
- Table Orders(id, cust, city, amount) rows: (1, 'Ana', 'Pune', 500), (2, 'Ben', 'Delhi', NULL), (3, 'Ana', 'Pune', 300), (4, 'Chen'…