Redis HRANDFIELD Command

The Redis HRANDFIELD command allows us to get a random field from a given key.

The command accepts several arguments that allows us to specify the number of random fields returned, whether to include the same field multiple times, and whether or not to include the values with each field returned.

The HRANDFIELD command was introduced in Redis 6.2.0.

Read more

Redis HEXISTS Command

In Redis, the HEXISTS command allows us to check whether a field exists in a given hash. We pass the name of the key and the field to the command, and it returns 1 if the field exists, and 0 if it doesn’t.

Read more

Redis HDEL Command

In Redis, the HDEL command enables us to delete one or more fields in a hash. It deletes the specified field/s at the specified key.

If the field doesn’t exist, it’s ignored. If the key doesn’t exist, it’s treated as an empty hash and 0 is returned.

Read more

Redis HSETNX Command

In Redis, the HSETNX command enables us to set a field in a hash, but only if the field doesn’t already exist. It sets the field at the specified key to the value we provide.

If the key doesn’t exist, it’s created with the specified hash value. If the field already exists, nothing is set (i.e. the command has no effect).

Read more

Redis HSET Command

In Redis, the HSET command enables us to set one or more fields in a hash. It sets the field/s at the specified key to the value/s we provide.

If the key doesn’t exist, it’s created with the specified hash value. If the field already exists, it is overwritten with the new value.

Read more

7 Ways to Insert Multiple Rows in SQL

We can use the SQL INSERT statement to insert a row into a table. We can also use it to insert more than one row.

Below are seven ways to insert multiple rows into a table in SQL. Most of these examples should work in the major RDBMSs, with the possible exception of Oracle. But no worries, I’ve included an example just for Oracle.

Read more