In PostgreSQL, the CASE expression 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.
Many SQL databases have a SUBSTR() or equivalent function that returns a substring from a specified string.
Redis has a SUBSTR command, but it was deprecated in Redis 2.0.0.
However, Redis also has the GETRANGE command, that basically does the same thing. Basically, anything that was possible with the Redis SUBSTR command, is now possible with the GETRANGE command.
And the GETRANGE command does basically the same thing that most of the SUBSTR() and SUBSTRING() functions do in the SQL world – gets a substring from a string.
In Redis, the OBJECT ENCODING command returns the internal encoding for the Redis object stored at the specified key.
In Redis, the RANDOMKEY command returns a random key from the currently selected database.
In Redis, the KEYS command returns all keys in the database matching a given pattern.
The Redis DUMP command serialises the value stored at a specified key in a Redis-specific format and returns it to the user.
The serialisation format contains a 64-bit checksum that is used to make sure errors will be detected. The values are in the same format used by the RDB. Also, an RDB version is encoded inside the serialised value, so that different Redis versions with incompatible RDB formats will refuse to process the serialised value.
The Redis TOUCH command alters the last access time of a key or keys. It allows us to alter the access time of a key without accessing it directly.
In Redis, the EXISTS command checks whether the specified keys exist. It returns an integer reply with the number of keys that exist.
We can use the command to check for the existence of one key or multiple keys.
The Redis SORT_RO command is a read-only variant of the SORT command. It allows us to sort lists, sets, and sorted sets.
The SORT command enables us to have the sorted elements returned to the client, or stored in a separate key. But the SORT_RO command only allows us to have them returned to the client.
The SORT_RO variant was introduced in Redis 7.0.0 to enable SORT functionality in read-only replicas without breaking compatibility on command flags.
In Redis, the SORT command allows us to sort lists, sets, and sorted sets.
We can have the sorted elements returned to the client, or we can store them in a separate key.