Files
doris/docs/en/sql-manual/sql-functions/conditional-functions/if.md
jiafeng.zhang 267e8b67c2 [refactor][doc]The new version of the document is online (#9272)
replace the `docs/` with `new-docs/`
2022-04-28 15:22:34 +08:00

1.3 KiB

title, language
title language
if en

if

description

Syntax

if(boolean condition, type valueTrue, type valueFalseOrNull)

Returns valueTrue when condition is true, returns valueFalseOrNull otherwise.

The return type is the type of the result of the valueTrue/valueFalseOrNull expression

example

mysql> select  user_id, if(user_id = 1, "true", "false") test_if from test;
+---------+---------+
| user_id | test_if |
+---------+---------+
| 1       | true    |
| 2       | false   |
+---------+---------+

keyword

IF