SQL - CASE ExpressionsWhich of the following best describes the behavior of the SQL function COALESCE?AReturns NULL if all expressions are non-NULLBReturns the first non-NULL value from a list of expressionsCReturns the last value in a list regardless of NULLsDReturns the count of non-NULL values in a listCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand COALESCECOALESCE evaluates its arguments in order and returns the first non-NULL value.Step 2: Analyze optionsReturns the first non-NULL value from a list of expressions correctly states this behavior. Options B, C, and D describe incorrect behaviors.Final Answer:Returns the first non-NULL value from a list of expressions -> Option BQuick Check:COALESCE(NULL, NULL, 5, 10) returns 5 [OK]Quick Trick: COALESCE picks first non-NULL value [OK]Common Mistakes:Thinking COALESCE returns last valueAssuming COALESCE counts non-NULLsBelieving COALESCE returns NULL if any value is NULL
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