14.4. Return

This is SQL’s SELECT. We just put it in the end because it felt better to have it there — you do a lot of matching and filtering, and finally, you return something.

Aggregate queries work just like they do in SQL, apart from the fact that there is no explicit GROUP BY clause. Everything in the return clause that is not an aggregate function will be used as the grouping columns.

SQL Query 

SELECT "Person".name, count(*)
FROM "Person"
GROUP BY "Person".name
ORDER BY "Person".name

NAMEC2
2 rows

Anakin

1

Bridget

1

Cypher Query 

MATCH (person:Person)
WHERE HAS (person.name)
RETURN person.name, count(*)
ORDER BY person.name

person.namecount(*)
2 rows

"Anakin"

1

"Bridget"

1

Order by is the same in both languages — ORDER BY expression ASC/DESC. Nothing weird here.