You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -432,60 +426,60 @@ Similar to xref:clauses/optional-match.adoc[`OPTIONAL MATCH`] any empty rows pro
432
426
.Difference between using `CALL` and `OPTIONAL CALL`
433
427
====
434
428
435
-
This example, which finds the friends of each `Player` and xref:functions/aggregating.adoc#functions-count[counts] the number of friends per player, highlights the difference between using `CALL` and `OPTIONAL CALL`.
429
+
This example, which finds the team that each `Player` plays for, highlights the difference between using `CALL` and `OPTIONAL CALL`.
436
430
437
431
.Regular subquery `CALL`
438
432
[source, cypher]
439
433
----
440
434
MATCH (p:Player)
441
435
CALL (p) {
442
-
MATCH (p)-[:FRIEND_OF]->(friend:Player)
443
-
RETURN friend
436
+
MATCH (p)-[:PLAYS_FOR]->(team:Team)
437
+
RETURN team
444
438
}
445
-
RETURN p.name AS playerName, count(friend) AS numberOfFriends
@@ -495,8 +489,8 @@ Now, all `Player` nodes, regardless of whether they have any friends or not, are
495
489
[[call-execution-order]]
496
490
== Execution order of CALL subqueries
497
491
498
-
The order in which subqueries are executed is not defined.
499
-
If a query result depends on the order of execution of subqueries, an `ORDER BY` clause should precede the `CALL` clause.
492
+
The order in which rows from the outer scope are passed into subqueries is not defined.
493
+
If the results of the subquery depend on the order of these rows, use an `ORDER BY` clause before the `CALL` clause to guarantee a specific processing order for the rows.
@@ -641,39 +635,33 @@ The result of the `CALL` subquery is the combined result of evaluating the subqu
641
635
642
636
.`CALL` subquery changing returned rows of outer query
643
637
====
644
-
The following example finds the name of each `Player` and the names of their friends.
645
-
No rows are returned for the `Player` nodes without any `FRIEND_OF` relationships, the number of results of the subquery thus changed the number of results of the enclosing query.
638
+
The following example finds the name of each `Player` and the team they play for.
639
+
No rows are returned for `Player C`, since they are not connected to a `Team` with a `PLAYS_FOR` relationship.
640
+
The number of results of the subquery thus changed the number of results of the enclosing query.
* `CALL` subqueries optimize data handling and query efficiency, and can perform changes to the database.
773
761
774
-
* `CALL` subqueries enable progressive data transformation and can accumulate results across multiple row executions.
762
+
* `CALL` subqueries allow for row-by-row data transformation and enable the accumulation of results across multiple rows, facilitating complex operations that depend on intermediate or aggregated data.
775
763
776
764
* `CALL` subqueries can only refer to variables from the enclosing query if they are explicitly imported by either a variable scope clause or an importing `WITH` clause (deprecated).
0 commit comments