---
title: "HMSET"
url: "https://docs.yugabyte.com/stable/yedis/api/hmset/"
---

# HMSET

## Synopsis

**`HMSET key field value [field value ...]`**

This command sets the data for the given `field` with the given `value` in the hash that is specified by `key`.

- If the given `field` already exists in the specified hash, this command overwrites the existing value with the given `value`.
- If the given `key` does not exist, a new hash is created for the `key`, and the given values are inserted to the associated given fields.
- If the given `key` is associated with a non-hash data, an error is raised.

## Return value

Returns status string.

## Examples

```sh
$ HMSET yugahash area1 "America" area2 "Africa"
```

```
"OK"
```

```sh
$ HGET yugahash area1
```

```
"America"
```

## See also

[`hdel`](/stable/yedis/api/hdel/ "hdel"), [`hexists`](/stable/yedis/api/hexists/ "hexists"), [`hget`](/stable/yedis/api/hget/ "hget"), [`hgetall`](/stable/yedis/api/hgetall/ "hgetall"), [`hkeys`](/stable/yedis/api/hkeys/ "hkeys"), [`hlen`](/stable/yedis/api/hlen/ "hlen"), [`hmget`](/stable/yedis/api/hmget/ "hmget"), [`hset`](/stable/yedis/api/hset/ "hset"), [`hincrby`](/stable/yedis/api/hincrby/ "hincrby"), [`hstrlen`](/stable/yedis/api/hstrlen/ "hstrlen"), [`hvals`](/stable/yedis/api/hvals/ "hvals")
