英[sɪˈlekt] 美[sɪˈlɛkt]

vt.Select; select; select

adj. Selected; selected; harshly selected; <口> like to pick three Picky, picky

Third person singular: selects Present participle: selecting Past tense: selected Past participle: selected

redis SELECT command syntax

Function:Switch to the specified database, the database index number index is specified with a numeric value, and 0 is used as the starting index value.

Syntax: SELECT index

Description: Use database number 0 by default.

Available versions: >= 1.0.0

Time complexity: O(1)

Return: OK

redis SELECT command example

redis> SET db_number 0         # 默认使用 0 号数据库
OK
redis> SELECT 1                # 使用 1 号数据库
OK
redis[1]> GET db_number        # 已经切换到 1 号数据库,注意 Redis 现在的命令提示符多了个 [1]
(nil)
redis[1]> SET db_number 1
OK
redis[1]> GET db_number
"1"
redis[1]> SELECT 3             # 再切换到 3 号数据库
OK
redis[3]>                      # 提示符从 [1] 改变成了 [3]