> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CASE

> CASE in Query Engine SQL.

<Note>
  This function isn't in the updated function reference yet. The details below come from the previous docs, and the product team is confirming them.
</Note>

## Syntax

CASE

Returns the result of the first condition evaluating to true or returns the default value if all conditions evaluate to false.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SYNTAX - CASE
             WHEN condition1 THEN result1
             [WHEN condition2 THEN result2 ]
             [WHEN ......]
             [ELSE default ]
         END
```

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
> select col1,
               case
                    when col1 < 0 then 'res1'
                    when col1 > 0 then 'res2'
                    else 'res3'
               end as result
           from table
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.