In Redis, the MGET
command allows us to get the values of multiple keys at once. The values are returned in an array reply.
If a specified key doesn’t exist, MGET
returns nil
for that key.
In Redis, the MGET
command allows us to get the values of multiple keys at once. The values are returned in an array reply.
If a specified key doesn’t exist, MGET
returns nil
for that key.
In Redis, the MSET
command allows us to set multiple keys at once. It replaces any existing values, just as SET
does.
The SQL Server CASE
statement evaluates a list of conditions and returns one of multiple possible result expressions.
Although it’s commonly known as the “CASE
statement”, the SQL Server documentation lists it as an expression. Plus it’s referred to as the “CASE
expression” in the SQL standard. Some other DBMSs distinguish between the CASE
statement and the CASE
expression. Either way, here’s a quick rundown on how the “CASE
statement” (or CASE
expression) works in SQL Server.
In Redis, the SET
command sets a key to hold a given string value.
If the key already holds a value, it is overwritten with the new value. Also, any previous time to live associated with the key is discarded (assuming a successful SET
operation).
In Redis, the GET
command returns the value of a given key. If the key doesn’t exist, it returns nil
.
An error is returned if the value stored at key
 is not a string.
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.