SQL - CASE ExpressionsWhat does the SQL function COALESCE do?AReturns the first non-NULL value from its argumentsBReturns NULL if two values are equalCAlways returns the last value in the listDConverts NULL values to zeroCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand COALESCE behaviorCOALESCE checks each argument in order and returns the first one that is not NULL.Step 2: Compare with other optionsNULLIF returns NULL if two values are equal, which is different. COALESCE does not convert NULL to zero automatically.Final Answer:Returns the first non-NULL value from its arguments -> Option AQuick Check:COALESCE = first non-NULL [OK]Quick Trick: COALESCE picks first non-NULL value in order [OK]Common Mistakes:Confusing COALESCE with NULLIFThinking COALESCE converts NULL to zeroAssuming COALESCE returns last value
Master "CASE Expressions" in SQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More SQL Quizzes Advanced Query Patterns - Finding duplicates efficiently - Quiz 4medium Advanced Query Patterns - Top-N per group query - Quiz 3easy Advanced Query Patterns - Finding gaps in sequences - Quiz 5medium Advanced Window Functions - NTH_VALUE function - Quiz 8hard Indexes and Query Performance - When indexes help and when they hurt - Quiz 12easy Indexes and Query Performance - Composite index and column order - Quiz 4medium Stored Procedures and Functions - User-defined functions - Quiz 4medium Triggers - AFTER trigger execution - Quiz 7medium Window Functions Fundamentals - ROW_NUMBER function - Quiz 15hard Window Functions Fundamentals - Window function vs GROUP BY mental model - Quiz 6medium