SQL CASE statement is used to provide conditional type of logic in SQL.in this syntax we are using the if else and then statement.in normal SAS no need to use the case statement but in case of proc SQL case statements are required for performing the logical operation. The CASE statement in SQL is used to check conditions and perform task on each row while selecting data. The syntax of case always starts with CASE keyword and ends with the END keyword followed by column names alias. The CASE expression goes through conditions and returns a value when the first condition is met (like an if-then-else-statement). So, once a condition is true, it will stop reading and return the result. If no conditions are true, it returns the value in ELSE clause. If there is no else part and no conditions are true, it returns NULL.
Syntax of CASE statement
CASE
WHEN condition1 THEN result1
WHEN condition2 THEN result2
WHEN conditionN THEN result
ELSE result
END;
Top SQL Online Training Institute in India
If you are looking best and cheap price SQL Course Training Institute near me? Then Durga Online Trainer is a best SQL Trainer in India. Our SQL Course fee is very low or cheap. Contact us today for join SQL Online Class.
You can join also online classes-