SELECT

AttentionThis page documents an earlier version. Go to the latest (v2.1)version.

Synopsis

SELECT is used to change the yedis database that the client is communicating with. By default, all client connections start off communicating with the default database (“0”). To start using a database, other than the default database (“0”), it needs to be pre-created using the CREATEDB command before use.

Return Value

Returns a status string if successful. Returns an error if the database is not already created.

Examples

You can do this as shown below.

  1. $ SET k1 v1
  1. "OK"
  1. $ GET k1
  1. "v1"
  1. $ LISTDB
  1. 1) "0"
  1. $ CREATEDB "second"
  1. "OK"
  1. $ SELECT "second"
  1. "OK"
  1. $ SET k1 v2
  1. "OK"
  1. $ GET k1
  1. "v2"
  1. $ SELECT 0
  1. "OK"
  1. $ GET k1
  1. "v1"

See Also

createdblistdbdeletedbflushdbflushallselect