English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis SUNION Command

Redis Sets (Set)

The Redis SUNION command returns the union of the given sets. Non-existent keys are treated as empty sets.

Syntax

The basic syntax of the Redis SUNION command is as follows:

redis 127.0.0.1:6379> SUNION KEY KEY1..KEYN

Available Version

>= 1.0.0

Return Value

List of union members.

Online Examples

redis> SADD key1 "a"
(integer) 1
redis> SADD key1 "b"
(integer) 1
redis> SADD key1 "c"
(integer) 1
redis> SADD key2 "c"
(integer) 1
redis> SADD key2 "d"
(integer) 1
redis> SADD key2 "e"
(integer) 1
redis> SUNION key1 key2
1) "a"
2) "c"
3) "b"
4) "e"
5) "d"
redis> 

Redis Sets (Set)