SQL Server 2012 introduced a new built-in logical function SQL IIF. It is a shorthand form of writing CASE statement logic or IF-ELSE logic.
We explored Case Statement in SQL in my earlier article. We use a case statement to return a result based on the defined condition. It is similar to an IF..ELSE…THEN statement evaluates an expression and returns the output. The case statement is available in almost all versions of SQL Server.
IIF( boolean_expression, true_value, false_value ) - Returns one of two values, depending on whether the Boolean expression evaluates to true or false in SQL Server.
🔥PLEASE LIKE and SUBSCRIBE🔥 - this will boost our motivation to create even more amazing videos.
Be a SQL HERO!
How would you handle this ? #sql #conditional #datascience #if #dataengineering #dataanalytics #sqlserver #data