In Oracle Database, the NULLIF()
function compares two expressions, and returns null
if both expressions are equal. If they are not equal, then the function returns the first expression.
Tag: comparison functions
NVL2() Function in Oracle
In Oracle Database, the NVL2()
function allows us to replace null values with another value.
It’s similar to the NVL()
function, except that it accepts three arguments instead of two. This allows us to specify a different value to return in the event the first argument is not null.
NVL() Function in Oracle
In Oracle Database, the NVL()
function allows us to replace null values with another value.
COALESCE() Function in Oracle
In Oracle Database, the COALESCE()
function returns the first non-null expression the expression list.
GREATEST() Function in Oracle
In Oracle Database, the GREATEST()
function returns the greatest of a list of one or more expressions.
LEAST() Function in Oracle
In Oracle Database, the LEAST()
function returns the least of a list of one or more expressions.
How LEAST() Works in MariaDB
In MariaDB, LEAST()
is a built-in function that returns the least (i.e. smallest/minimum-valued) argument from its list of arguments.
To get the greatest value, use GREATEST()
.
How GREATEST() Works in MariaDB
In MariaDB, GREATEST()
is a built-in function that returns the greatest (i.e. largest/maximum-valued) argument from its list of arguments.
To return the minimum-valued argument, use LEAST()
.
How SQLite Nullif() Works
The SQLite nullif()
function is a handy function that allows you to treat certain values as NULL when required.
It’s not to be confused with the ifnull()
function, which does the opposite – enables you to treat NULL values as something else.
The nullif()
function accepts two arguments, and returns its first argument if the arguments are different and NULL if the arguments are the same.
How SQLite Ifnull() Works
The SQLite ifnull()
function allows you to replace NULL values with another value.
It takes two arguments, and it returns a copy of its first non-NULL argument, or NULL if both arguments are NULL.
The ifnull()
function is equivalent to coalesce()
with two arguments.