When using Redis, we can use the LASTSAVE
command to get the Unix time of the last DB save.
More specifically, LASTSAVE
returns the Unix time of the last DB save executed with success.
When using Redis, we can use the LASTSAVE
command to get the Unix time of the last DB save.
More specifically, LASTSAVE
returns the Unix time of the last DB save executed with success.
Some DBMSs have an NVL2()
function that allows us to replace a value with another value, the new value being determined by whether or not the initial value is null.
It’s similar to the NVL()
function, except that NVL2()
accepts exactly three arguments. This allows us to specify a different value to return in the event the first argument is not null.
In contrast, with the NVL()
function, some DBMSs accept only two arguments (which makes the function a synonym for the IFNULL()
function) while others accept an unlimited number of arguments (which makes it a synonym for the COALESCE()
function).
Some DBMSs provide an NVL()
function, which can be used when working with potentially NULL values. The function allows us to replace any NULL values with another value.
In Oracle Database, the CASE
statement compares a list of conditions and returns one of multiple possible expressions.
Oracle Database’s CASE
statement is very similar to the CASE
expression (which is defined in the SQL standard (ISO/IEC 9075)). However, Oracle supports both the CASE
expression and the CASE
statement, and there’s a distinction between the two. The CASE
statement can be used to execute of a sequence of PL/SQL statements, whereas the CASE
expression returns a single value. Also, there’s a difference in how they deal with the lack of an ELSE
clause when a condition is not met.
In Oracle Database, the CASE
expression compares a list of conditions and returns one of multiple possible expressions. It allows us to use IF
… THEN
… ELSE
logic in SQL statements without having to invoke procedures.
The CASE
expression is included in the SQL standard (ISO/IEC 9075), and most major RDBMSs support it.
Oracle also has a CASE
statement that’s very similar to the CASE
expression, but with some minor differences.
Some RDBMSs provide an ISNULL()
function that can be used when dealing with potentially null values.
MySQL, MariaDB, and Oracle Database each have an ISNULL()
function that returns 1
if its argument is null
, and 0
if it’s not.
SQL Server also has an ISNULL()
function, but it works differently. It works more like how the IFNULL()
function works in some other RDBMSs.
Other RDBMSs, such as PostgreSQL and SQLite don’t include an ISNULL()
function, but they do support the IS NULL
predicate (as do the other RDBMSs).
In PostgreSQL, the COALESCE()
operator returns the first non-null value from its list of arguments. If all arguments are null
, it returns null
.
In MySQL, the CASE
statement can be used in stored programs to perform a complex conditional construct. It compares a list of conditions and returns a different result depending on which condition (if any) is matched.
The CASE
statement is different to the CASE
operator, in that the CASE
statement is specifically for use in stored programs. Also, there’s a slight difference in the syntax.
In MySQL, the CASE
operator compares a list of conditions and returns one of multiple possible result expressions.
The CASE
expression is included in the SQL standard (ISO/IEC 9075), and most major RDBMSs support it.
MySQL also has the CASE
statement, which is slightly different to the CASE
operator. This article is about the CASE
operator.
In MariaDB, we can use the CASE
operator to compare a list of conditions and return a different result depending on which condition (if any) is matched.
The CASE
expression is included in the SQL standard (ISO/IEC 9075), and most major RDBMSs support it.
MariaDB also has the CASE
statement, which is slightly different to the CASE
operator. This article is about the CASE
operator.