if statement in sql in where clause code example Example: if in sql SELECT IF(500<1000, "YES", "NO");