NULLIF(expr1, expr2) returns NULL if the two expressions are equal or else returns expr1. It's a function used by many DBs like PostgreSQL, MySQL, MS-SQL server and others.