Skip to content

Commit

Permalink
add annotation to some examples of set clause (#2433)
Browse files Browse the repository at this point in the history
* add annotation to some examples of `set` clause

as titled

* Update 6.set.md

---------

Co-authored-by: cooper-lzy <[email protected]>
  • Loading branch information
knqiufan and cooper-lzy authored Jan 29, 2024
1 parent 99174c7 commit aac5c81
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs-2.0-zh/3.ngql-guide/5.operators/6.set.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ nebula> GO FROM "player102" OVER follow YIELD dst(edge) \
| "player125" |
+-------------+
# 查询 Tag 为 player 的点,根据名称排序后获取前 3 条数据,并与数组合并返回,不包含重复的元素。
nebula> MATCH (v:player) \
WITH v.player.name AS n \
RETURN n ORDER BY n LIMIT 3 \
Expand Down Expand Up @@ -63,6 +64,7 @@ nebula> GO FROM "player102" OVER follow YIELD dst(edge) \
| "player125" |
+-------------+
# 查询 Tag 为 player 的点,根据名称排序后获取前 3 条数据,并与数组合并返回,包含重复的元素。
nebula> MATCH (v:player) \
WITH v.player.name AS n \
RETURN n ORDER BY n LIMIT 3 \
Expand Down Expand Up @@ -120,6 +122,7 @@ nebula> GO FROM "player102" OVER follow \
+----+--------+-----+
+----+--------+-----+
# 返回 player102 的邻居和边数据与 player100 的邻居和边数据之间的交集。
nebula> MATCH (v:player)-[e:follow]->(v2) \
WHERE id(v) == "player102" \
RETURN id(v2) As id, e.degree As Degree, v2.player.age AS Age \
Expand All @@ -132,6 +135,7 @@ nebula> MATCH (v:player)-[e:follow]->(v2) \
+----+--------+-----+
+----+--------+-----+
# 返回 [1,2] 与 [1,2,3,4] 的交集。
nebula> UNWIND [1,2] AS a RETURN a \
INTERSECT \
UNWIND [1,2,3,4] AS a \
Expand Down Expand Up @@ -165,6 +169,7 @@ nebula> GO FROM "player100" OVER follow YIELD dst(edge) \
| "player125" |
+-------------+
# 返回在 player102 的邻居中,但不在 player100 的邻居中的元素。
nebula> GO FROM "player102" OVER follow YIELD dst(edge) AS id \
MINUS \
GO FROM "player100" OVER follow YIELD dst(edge) AS id;
Expand All @@ -174,6 +179,7 @@ nebula> GO FROM "player102" OVER follow YIELD dst(edge) AS id \
| "player100" |
+-------------+
# 返回在 player102 的邻居中,但不在 player100 的邻居中的元素。
nebula> MATCH (v:player)-[e:follow]->(v2) \
WHERE id(v) =="player102" \
RETURN id(v2) AS id\
Expand All @@ -187,6 +193,7 @@ nebula> MATCH (v:player)-[e:follow]->(v2) \
| "player100" |
+-------------+
# 返回 [1,2,3] 中不与 4 相同的元素。
nebula> UNWIND [1,2,3] AS a RETURN a \
MINUS \
WITH 4 AS a \
Expand Down

0 comments on commit aac5c81

Please sign in to comment.