正解:A,B,D
In Oracle Database 12c, when dealing with NULL values in arithmetic expressions, the functions NVL, NVL2, and equivalent techniques using NULLIF or arithmetic operations with NULL can be crucial.
Option A: SELECT * FROM employees WHERE salary + NULLIF(commission, 0) >= 20000; NULLIF(value1, value2) returns NULL if value1 is equal to value2, otherwise it returns value1. In this case, if commission is NULL, it treats it as 0.
This query correctly adds salary and commission (assuming 0 when commission is NULL) and checks if the total is at least 20000.
Option B: SELECT * FROM employees WHERE salary + NVL2(commission, commission, 0) >= 20000; NVL2(expr1, expr2, expr3) returns expr2 if expr1 is not NULL; otherwise, it returns expr3. Here, if commission is not NULL, it uses commission, otherwise 0.
This condition correctly calculates salary + commission (assuming commission as 0 if it is NULL) and checks if the total is at least 20000.
Option D: SELECT * FROM employees WHERE salary + NVL(commission, 0) >= 20000; NVL(expr1, expr2) returns expr2 if expr1 is NULL; otherwise, it returns expr1. This query treats commission as 0 if it is NULL.
It correctly sums salary and commission and compares the result against 20000.
Options C, E, and F contain either syntax errors or logical errors in handling NULLs and comparisons.