Which of the following is the correct syntax for using NULLIF in SQL?
easy📝 Syntax Q12 of 15
SQL - CASE Expressions
Which of the following is the correct syntax for using NULLIF in SQL?
ANULLIF(value1, value2)
BNULLIF(value1 = value2)
CNULLIF(value1; value2)
DNULLIF(value1, value2, value3)
Step-by-Step Solution
Solution:
Step 1: Recall NULLIF syntax
NULLIF takes exactly two arguments separated by a comma: NULLIF(value1, value2).
Step 2: Eliminate incorrect options
NULLIF(value1 = value2) uses an equality inside parentheses, which is invalid syntax. NULLIF(value1; value2) uses a semicolon instead of a comma. NULLIF(value1, value2, value3) has three arguments, which is not allowed.
Final Answer:
NULLIF(value1, value2) -> Option A
Quick Check:
NULLIF syntax = NULLIF(val1, val2) [OK]
Quick Trick:NULLIF takes exactly two comma-separated values [OK]
Common Mistakes:
Using semicolon instead of comma
Passing more than two arguments
Using an expression inside NULLIF parentheses
Master "CASE Expressions" in SQL
9 interactive learning modes - each teaches the same concept differently