13subquery.mql 737 B

12345678910111213141516171819202122232425262728293031
  1. -- ============================================================
  2. -- Cypher 子查询测试
  3. -- ============================================================
  4. -- 1. Cypher 子查询 - where in match
  5. match (a:test_graph) -[:connect]-> (b:test_graph) where a.g_name in (match (n:test_graph) where n.g_type='type_a' return n.g_name) return a, b
  6. /**
  7. output()
  8. **/
  9. ;
  10. -- 2. Cypher 嵌套子查询
  11. match (a:test_graph) where a.g_value = (match (n:test_graph) where n.g_name='node_c' return max(n.g_value)) return a
  12. /**
  13. output()
  14. **/
  15. ;
  16. -- 3. Cypher 聚合子查询
  17. match (a:test_graph) where a.g_type='type_a' return a.g_type, count(*)
  18. /**
  19. output()
  20. **/
  21. ;
  22. -- 4. Cypher 带 limit 的子查询
  23. match (a:test_graph) return a limit 3
  24. /**
  25. output()
  26. **/
  27. ;