---
title: "SELECT"
url: "https://docs.yugabyte.com/stable/yedis/api/select/"
---

# SELECT

## 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

```sh
$ SET k1 v1
```

```
"OK"
```

```sh
$ GET k1
```

```
"v1"
```

```sh
$ LISTDB
```

```
1) "0"
```

```sh
$ CREATEDB "second"
```

```
"OK"
```

```sh
$ SELECT "second"
```

```
"OK"
```

```sh
$ SET k1 v2
```

```
"OK"
```

```sh
$ GET k1
```

```
"v2"
```

```sh
$ SELECT 0
```

```
"OK"
```

```sh
$ GET k1
```

```
"v1"
```

## See also

[`createdb`](/stable/yedis/api/createdb/ "createdb") [`listdb`](/stable/yedis/api/listdb/ "listdb") [`deletedb`](/stable/yedis/api/deletedb/ "deletedb") [`flushdb`](/stable/yedis/api/flushdb/ "flushdb") [`flushall`](/stable/yedis/api/flushall/ "flushall") [`select`](/stable/yedis/api/select/ "select")
