# HSET Sets the specified fields to their respective values in the hash stored at `key`. This command overwrites the values of specified fields that exist in the hash. If `key` doesn't exist, a new key holding a hash is created. ## Examples > HSET myhash field1 "Hello" (integer) 1 > HGET myhash field1 "Hello" > HSET myhash field2 "Hi" field3 "World" (integer) 2 > HGET myhash field2 "Hi" > HGET myhash field3 "World" > HGETALL myhash 1) "field1" 2) "Hello" 3) "field2" 4) "Hi" 5) "field3" 6) "World" Give these commands a try in the interactive console: HSET myhash field1 "Hello" HGET myhash field1 HSET myhash field2 "Hi" field3 "World" HGET myhash field2 HGET myhash field3 HGETALL myhash ## Return information {{< multitabs id="hset-return-info" tab1="RESP2" tab2="RESP3" >}} [Integer reply](../../develop/reference/protocol-spec#integers): the number of fields that were added. -tab-sep- [Integer reply](../../develop/reference/protocol-spec#integers): the number of fields that were added.