In Redis, the RENAME
command renames a key. It allows us to give a key a new name.
Category: DBMS
Database Management Systems
Return Only Numeric Values in SQL
If you ever need to use SQL to return just the numeric values in a character column, the method you use will largely depend on your DBMS. Most DBMSs support regular expressions (regex), but some don’t. And some include functions that can detect numeric values.
Here are examples of how to do it in the more popular DBMSs.
Continue readingRedis COPY Command Explained
In Redis, the COPY
command copies the value from one key to another.
This command was introduced in Redis 6.2.0.
Continue readingRedis RESTORE Command Explained
In Redis, the RESTORE
command creates a key associated with a value that is obtained by deserialising the provided serialised value (obtained via the DUMP
command).
The serialisation format contains a 64-bit checksum, as well as the RDB version. The RESTORE
command checks the RDB version and data checksum. If they don’t match an error is returned.
Redis GETRANGE Command Explained
In Redis, the GETRANGE
command allows us to get part of a string at a given key, starting and ending at the specified offsets.
The GETRANGE
command replaced the SUBSTR
command, which basically does the same thing. The SUBSTR
command is now considered deprecated (as of Redis 2.0.0).
Redis SETRANGE Command Explained
In Redis, the SETRANGE
command allows us to overwrite part of a string at a given key, starting at a specified offset. It overwrites the old value from the specified offset, for the entire length of the new value.
MariaDB CASE Statement
In MariaDB, 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 distinct from the CASE
operator, in that the CASE
statement is specifically for use in stored programs. Also, there’s a slight difference in the syntax.
Redis DECRBY Command Explained
In Redis, the DECRBY
command decrements the value of a key by the specified amount.
If the key doesn’t exist, DECRBY
creates the key with a value of 0
and then decrements it by the specified amount.
An error occurs if the key contains a value of the wrong type or contains a string that cannot be represented as integer. DECRBY
operations are limited to 64 bit signed integers.
Redis DECR Command Explained
In Redis, the DECR
command decrements the value of a specified key by one.
If the key doesn’t exist, DECR
creates the key with a value of 0
and then decrements it by one.
An error occurs if the key contains a value of the wrong type or contains a string that cannot be represented as integer.
Continue readingRedis INCRBYFLOAT Command Explained
In Redis, the INCRBYFLOAT
command increments a floating point number by the specified amount. More specifically, it increments the string representing a floating point number stored at the specified key.
If the key doesn’t exist, INCRBYFLOAT
creates the key with a value of 0
and then increments it by the specified amount.
An error occurs if the key contains a value of the wrong type, or if the current key content or the specified increment are not parsable as a double precision floating point number.
Continue reading