Syntax
Parameters
| Parameter | Description | Supported input types |
|---|---|---|
<condition> | A condition can be defined for each WHEN clause. | BOOLEAN |
<result> | The result of the CASE expression when the preceding condition holds. Every THEN clause receives a single result. All results in a single CASE expression must share the same data type. | Any |
Return type
Same data type as<result>
Example
This example references a tableplayer_level with the following columns and values:
| player | current_level |
|---|---|
| kennethpark | 3 |
| esimpson | 8 |
| sabrina21 | 11 |
| rileyjon | 15 |
| burchdenise | 4 |
| player | current_level | ranking |
|---|---|---|
| burchdenise | 4 | Beginner |
| esimpson | 8 | Intermediate |
| kennethpark | 3 | Beginner |
| rileyjon | 15 | Expert |
| sabrina21 | 11 | Intermediate |