IF

The three argument function that evaluates its first argument as a boolean, and then returns either its second value or its third.

Parameter Type
value0
boolean
value1
anyatomictype
value2
anyatomictype
Returns: anyatomictype

Example

query:

SELECT sales_agent,
       IF(status = "Former", NULL, "Active")
  FROM sales_teams

results:

sales_agent if
Anna Snelling Active
Cecily Lampkin Active
Mei-Mei Johns Active
Violet Mclelland Active
Corliss Cosme Active
Rosie Papadopoulos Active
Garret Kinder
Wilburn Farren Active
Elizabeth Anderson Active
Daniell Hammack Active