In MySQL, the ISNULL()
function enables us to check whether a value is null
or not. If it’s null
, then 1
is returned, otherwise 0
is returned.
Tag: functions
How IFNULL() Works in MariaDB
In MariaDB, the IFNULL()
function allows us to replace NULL values with another value.
How NVL() Works in MariaDB
From MariaDB 10.3, NVL()
can be used as an alias for the IFNULL()
function. Therefore, both functions enable us to replace NULL values with another value.
MySQL IF() Function Explained
MySQL has an IF()
function that provides a convenient way to perform a simple “IF/ELSE” operation.
It works similar to a basic IF
/ELSE
statement, in that it allows us to check for a condition, and return a different result depending on whether it’s true or not.
More specifically, if the first argument to the IF()
function is true, the second argument is returned. If it’s not true, the third argument is returned.
MySQL NULLIF() Explained
In MySQL, NULLIF()
is a flow control function that returns NULL
if both of its arguments are equivalent. Otherwise it returns the first argument.
JSON_INSERT() vs JSON_SET() vs JSON_REPLACE() in SQLite
SQLite provides several functions for inserting, setting, and replacing values in a JSON document. Specifically, it provides json_insert()
, json_set()
, and json_replace()
.
These functions perform similar tasks, and you can sometimes use them interchangeably to a certain point.
But there is definitely a clear difference between each function.
Continue readingSQL Server COALESCE() Explained
In SQL Server, the COALESCE()
expression returns its first non-null argument.
The way it works is, we pass a list of arguments to the expression, it evaluates the arguments in order and returns the current value of the first expression that initially doesn’t evaluate to NULL
.
UPPER() – Convert to Uppercase in PostgreSQL
In PostgreSQL, we can use the upper()
function to convert lowercase characters to their uppercase equivalent, according to the rules of the database’s locale.
LOWER() – Convert to Lowercase in PostgreSQL
In PostgreSQL, we can use the lower()
function to convert uppercase characters to their lowercase equivalent, according to the rules of the database’s locale.
INITCAP() – Convert to Initial Caps in PostgreSQL
In PostgreSQL, we can use the initcap()
function to format a string of text to use initial capitals. That is, it converts the first letter of each word to upper case and the rest to lower case.