Question 1
The COMMISSION column of EMPLOYEES is optional: an employee with no commission plan stores no value at all in that column. ``` LAST_NAME COMMISSION --------- ---------- King (null) Chen 0.1 Diaz 0.15 Novak (null) Osei 0.05 Petrov (null) Quinn 0.2 Rossi (null) ``` How many rows does the following query return? ```sql SELECT last_name FROM employees WHERE commission <> 0.10; ```
A. 7
Treats the absent value as a value that is trivially different from 0.10, adding the four commission-less rows to the three real matches. A comparison against NULL is UNKNOWN, never TRUE.
B. 4
Confuses "not equal to 0.10" with "has a commission at all", keeping every row that stores a value including Chen's 0.10. The inequality still excludes the row whose value equals the literal.
C. 3Correct answer
Only the four rows that hold a value can be compared: 0.15, 0.05 and 0.2 satisfy the inequality and 0.1 does not, while each NULL row evaluates to UNKNOWN and is discarded — three rows.
D. 0
Assumes that a NULL anywhere in the column makes the predicate UNKNOWN for the whole table. The condition is evaluated independently per row, so rows holding real values are unaffected by the NULLs in other rows.
Explanation
In the relational model a column that holds no value stores NULL, which represents an absent or unknown value rather than a particular one. Any comparison operator applied to NULL yields UNKNOWN, and a WHERE clause returns a row only when its condition evaluates to TRUE, so rows with no value are dropped by an inequality just as they are by an equality test. Retrieving them requires the IS NULL operator.