This SQLite post explains how to use the SQLite nullif function with syntax and examples.
The SQLite nullif function returns NULL if two expressions are equivalent. Otherwise, it returns the first expression.
The syntax for the nullif function in SQLite is:
nullif( expression1, expression2 )
Two expressions to test if equivalent, expression1 = expression2.
The nullif function can be used in the following versions of SQLite:
Let's look at some SQLite nullif function examples and explore how to use the nullif function in SQLite.
For example:
sqlite> SELECT nullif('AODBA.com', 'AODBA.com');
Output: NULL
sqlite> SELECT nullif('AODBA.com', 'checkyoursite.com');
Output: 'AODBA.com'
sqlite> SELECT nullif(1, 1);
Output: NULL
sqlite> SELECT nullif(1, 2);
Output: 1