You get a bonus - 1 coin for daily activity. Now you have 1 coin

Redis Lab Exercises

Lecture



Assignment for laboratory work 1:

1. Create the key name:id:1 from the student's name (enter your own
name).

2. Output the value of the key created in the previous step.

3. Using the exists command, check whether the keys name:id:1 and
name:id:2 exist.

4. Create the key name:id:2 and assign it any name.

5. Change the value of name:id:2 to any other name, while
outputting its previous value to the screen.

6. Create the key age:id:1 and assign it an integer value of the student's
age (any value).

7. Using the type command, check the value types of the keys
age:id:1 and name:id:1.

8. Output to the screen all keys ending with a one. Output
all keys.

9. Rename the key name:id:1 to DELETED.
10. Delete all created keys.

11. Create the keys name, age and group with a single command. (set the values
of the keys arbitrarily)

12. Delete all created keys.

13. Increase the value of age by one, and then decrease it by
one.

14. Increase the value of age by 20, and then reduce it by 10

15. Create an arbitrary key with an arbitrary value that
will be deleted after ([number in the group list] + 20 seconds). (using
the ttl command, output several times how long until
the key is deleted).

Assignment for laboratory work 2:

1. Create a list names consisting of five arbitrary names.
(The first three elements must be inserted at the end of the list, and
the last two – at the beginning)

2. Output one by one: all elements of the list, the first and second, from
the third to the fifth.

3. Delete the first and last element of the list. Output the length
of the list.

4. Create a hash table with three keys: name, age and group.
Output the table's keys, the values of the keys, and then the keys and values.

5. Increase the value of a hash table key by |ordinal number in the
group list|

6. Create a set set:1 consisting of 5 arbitrary values
from 1 to 15. Create a set set:2 consisting of 5 values
from 1 to 5

7. Find the intersection of the sets set:1 and set:2.

8. Create a sorted set people, in which the score parameter
will hold birth years. (The set must contain 7 - 10
values. Names are chosen arbitrarily. Score is chosen as any value from
the interval [1950 – 2000] ).

9. Output all values of the set created in the previous step.

10. Output all names of people older than the year 1970. Output the names
of people born between 1970 and 1980.

11. Output the values of the set of people in descending order

12. Start a transaction in which you need to: create three keys name and age
(age must be an integer, and name a string), increase the value of the key age
by 1, and append a surname to the key name (the
append command), rename name to name:surname.

Download to read ad-free

13. Commit the transaction.

14. Repeat the steps of the previous point, but abort
the transaction at one of the stages

created: 2026-07-12
updated: 2026-07-12
1



Was this answer useful?
Choose a quick rating so we can improve the next answer for you.
How satisfied are you?


Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Databases - Redis DB Nosql"

Terms: Databases - Redis DB Nosql