IF (predicate, expression1, expression2)

Returns expression1 if the predicate is true; otherwise, returns expression2.

The system scalar functions IF and NULL are SQL extensions.

IF allows you to enter different values depending on whether the condition is true or false. For example, if you want to display a column with logical values as “true” or “false” instead of a binary representation, you would use the following SQL statement:

SELECT IF(logicalcol=1, 'True', 'False')

Thursday, 18 April 2019 Posted in Logical Functions