Redis is a key-value store that uses an in-memory data structure. Unlike relational databases that use tables to organize data, Redis stores data as key-value pairs and provides various data structures to store and manipulate values.
In Redis, data is organized into databases, which are identified by their numeric index. By default, Redis has 16 databases (indexed from 0 to 15), but this can be configured in the Redis configuration file.
Each database in Redis contains key-value pairs. The keys in Redis can be any binary-safe string, while the values can be one of several data structures, such as strings, hashes, lists, sets, and sorted sets. These data structures are similar to tables in relational databases in that they allow you to organize data in a structured way and perform operations on it.
For example, you can use the
SET command to store a value in Redis:
> SET mykey "Hello Redis" OK
mykey is the key, and
"Hello Redis" is the value. You can use the
GET command to retrieve the value:
> GET mykey "Hello Redis"
In addition to the basic data structures, Redis also provides more advanced data structures, such as bitmaps, hyperloglogs, and geospatial indexes, that enable you to store and manipulate data in specific ways.
Therefore, Redis does not have tables in the traditional sense, but it offers various data structures that provide similar functionality to tables in relational databases.