CASE EXPRESSION | SQL Server | SQL Tutorial

Published: 04 December 2022
on channel: Uday Bhoyar
154
8

The CASE expression is used to implement the logic where you want to set the value of one column depending upon the values in other columns.
The SQL Server CASE expression consists of at least one pair of WHEN and THEN expressions. The WHEN expression specifies the condition to be tested. The THEN expression specifies the action if the WHEN condition returns TRUE.
The ELSE expression is optional and executes when none of the WHEN conditions return true. The CASE expression ends with an END keyword.


Simple CASE expression:

CASE input_expression
WHEN when_expression THEN result_expression [ ...n ]
[ ELSE else_result_expression ]
END

Searched CASE expression:

CASE
WHEN Boolean_expression THEN result_expression [ ...n ]
[ ELSE else_result_expression ]
END


On this page of the site you can watch the video online CASE EXPRESSION | SQL Server | SQL Tutorial with a duration of hours minute second in good quality, which was uploaded by the user Uday Bhoyar 04 December 2022, share the link with friends and acquaintances, this video has already been watched 154 times on youtube and it was liked by 8 viewers. Enjoy your viewing!