Below are examples of using SQL to return the last day of the month across various DBMSs.
This could be the last day of the current month, or the last day of a month based on a given date.
Continue readingBelow are examples of using SQL to return the last day of the month across various DBMSs.
This could be the last day of the current month, or the last day of a month based on a given date.
Continue readingIn Redis, the MSETNX
command allows us to set multiple keys at once, but only if none of them exist.
This allows us to set multiple keys representing different fields of a single logical object in a way that ensures that either all the fields are set, or none are set.
Continue readingIn 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.
Below are the steps that I used to install Redis on my M1 Mac. The M1 Mac (and M2) uses the ARM64 architecture, but this is not a problem, as Redis versions 4.0 and above support the ARM architecture.
Continue readingIn SQLite we can use the lower()
function to convert uppercase characters to lowercase.