SQL Query: A Simple Use of SQL CASE Expression
What is CASE Expression
CASE is the special scalar expression in SQL language. CASE expression is widely used to facilitate determining / setting a new value from user input values. CASE expression can be used for various purposes which depends on the business logic.CASE expression is mostly used in SQL stored procedure or as a formula for a particular column, which optimizes the SQL statements.Syntax of CASE Expression
SQL CASE expression is used as a type of
IF-THEN-ELSE statement. It is similar to switch statement in recent programming languages such as C# and Java. The syntax of the CASE statement is simple as follows:1. CASE column_name
2. WHEN condition1 THEN result1
3. WHEN condition2 THEN result2
4. ...
5. ELSE result
6. END
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home