# How to use case function in SQL?

- column1 , column2 , ... are the column names to be included in the result set.
- CASE checks the condition.
- result is the result or value to be inserted to the new column if condition is satisfied.
- END ends the CASE statement.
- AS specifies the name alias_name for the new column.
- table is the name of the table.

Bron: [SQL CASE Syntax](https://www.programiz.com/sql/case)

Onderwerp: [Techniek & internet](https://1001vragen.nl/onderwerp/techniek-en-internet)
Toegevoegd: 2026-01-26
Webpagina: https://1001vragen.nl/vraag/how-to-use-case-function-in-sql

## How to use case function?

The CASE function allows you to perform multiple conditional tests on a set of expressions within a single statement. When a test evaluates to true , a corresponding output is generated. Outputs may be a literal or expression. For more information on the IF function, see IF Function.

Bron: [CASE Function - Alteryx Help](https://help.alteryx.com/aac/en/trifacta-classic/wrangle-language/other-functions/case-function.html#:~:text=The%20CASE%20function%20allows%20you,IF%20function%2C%20see%20IF%20Function.)

## Why do we use case when in SQL?

The SQL CASE function is a powerful and versatile conditional expression that allows you to perform conditional logic within SQL queries. It is used to evaluate multiple conditions and return different values or perform different actions based on the results of these conditions.

Bron: [SQL CASE - Syntax, Use Cases, and Examples - Hightouch](https://hightouch.com/sql-dictionary/sql-case#:~:text=The%20SQL%20CASE%20function%20is,the%20results%20of%20these%20conditions.)

## Verwante vragen

- [Which functions can be used to manipulate character number and date column values?](https://1001vragen.nl/vraag/which-functions-can-be-used-to-manipulate-character-number-and-date-column-values.md)
- [What is the CAST function in Oracle?](https://1001vragen.nl/vraag/what-is-the-cast-function-in-oracle.md)
- [How to use conversion function?](https://1001vragen.nl/vraag/how-to-use-conversion-function.md)
- [What is the CHR function in SQL?](https://1001vragen.nl/vraag/what-is-the-chr-function-in-sql.md)
- [How to use the CAST function in SQL?](https://1001vragen.nl/vraag/how-to-use-the-cast-function-in-sql.md)
- [Which function is used to concatenate two or more strings?](https://1001vragen.nl/vraag/which-function-is-used-to-concatenate-two-or-more-strings.md)
- [What is the use of the cast() function in SQL?](https://1001vragen.nl/vraag/what-is-the-use-of-the-cast-function-in-sql.md)
- [How to fix ora 00937 not a single group group function?](https://1001vragen.nl/vraag/how-to-fix-ora-00937-not-a-single-group-group-function.md)
- [How to use CAST function in Oracle?](https://1001vragen.nl/vraag/how-to-use-cast-function-in-oracle.md)
- [What is the function of CHR in Oracle?](https://1001vragen.nl/vraag/what-is-the-function-of-chr-in-oracle.md)
