-
Notifications
You must be signed in to change notification settings - Fork 64
Add and update documentation on Exists and Count subquery expressions #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add and update documentation on Exists and Count subquery expressions #182
Conversation
|
Looks like you've updated the documentation! Check out your changes at https://neo4j-docs-cypher-182.surge.sh |
5f771e9 to
f4de44c
Compare
|
Turned it into a draft as this is targeting 5.3 release :) |
Lojjs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good, but there are some additional things I think would be good to include/clarify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not your fault, but I noticed that the Subquery expressions (and some other Expressions sections as well) are missing from this menu: https://neo4j-docs-cypher-182.surge.sh/cypher-manual/5.0/syntax/. In the published docs it is also broken, but in a different way. Perhaps something we should do a card to the docs team for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice spotting :) Easy enough for me to add the links, what is broken though? I can make a card reporting that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the published docs here https://neo4j.com/docs/cypher-manual/current/syntax/ there are another subset of the links under Expressions that are missing, weirdly enough
Lojjs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now :)
91688c4 to
25b4a97
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Any non-writing query is allowed, how it differs from regular queries is that the final `RETURN` clause may be omitted | |
| Any non-writing query is allowed. `EXISTS` subqueries differ from regular queries in that the final `RETURN` clause may be omitted, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| It is worth noting that the `MATCH` keyword can be omitted in subqueries in the case where the `EXISTS` consists of only | |
| It is worth noting that the `MATCH` keyword can be omitted in subqueries in cases where the `EXISTS` consists of only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| unlike the case for `CALL` subqueries, xref::clauses/call-subquery.adoc#subquery-correlated-importing[where they require importing]. | |
| In this regard, `EXISTS` subqueries are different from `CALL` subqueries, xref::clauses/call-subquery.adoc#subquery-correlated-importing[which do require importing]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the "at least" part necessary here?
| Here is the result that shows if at least one row is returned from the union of 2 queries. | |
| The result of returning one row from a union of two queries is shown below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this one doesn't make sense either, it isn't the result of returning one row, it is that if one of the union branches was to return at least one row, the entire exists evaluates to true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a different way to say "will not go out of scope" here? I am a little confused by the sentence. Maybe it could be rephrased like this:
| Variables from the outside scope will not go out of scope when using a `WITH`, they are visible for the entirety of the subquery, | |
| Variables from the outside scope are visible for the entirety of the subquery when using a `WITH` clause. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't quite what I meant, so variables are visible for the entire subquery, even if you were to use a WITH clause
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Shadowing of an outside scope variable is when a newly introduced variable inside the inner scope is defined with the same name as one from the outside scope. | |
| An outside scope variable is shadowed when a newly introduced variable within the inner scope is defined with the same variable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Here is an example where a `WITH` clause introduces a new variable, | |
| In the below example, a `WITH` clause introduces a new variable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| and the outer scope variable person being referenced is still available after: | |
| The outer scope variable `person` referenced in the main query is still available after the subquery. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't available "after" the subquery, but after the WITH clause though 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `COUNT` subqueries do not require a `RETURN` clause at the end of the subquery, but if one is present, it does not | |
| `COUNT` subqueries do not require a `RETURN` clause at the end of the subquery. If one is present, it does not need to be aliased.``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| need to be aliased, a difference from xref::clauses/call-subquery.adoc[`CALL` subqueries]. | |
| This is a difference compared to from xref::clauses/call-subquery.adoc[`CALL` subqueries]. |
6229b45 to
34fd359
Compare
JPryce-Aklundh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
No description provided.