YMatrix
Quick Start
Connecting
Benchmarks
Deployment
Data Usage
Manage Clusters
Upgrade
Global Maintenance
Expansion
Monitoring
Security
Best Practice
Technical Principles
Data Type
Storage Engine
Execution Engine
Streaming Engine(Domino)
MARS3 Index
Extension
Advanced Features
Advanced Query
Federal Query
Grafana
Backup and Restore
Disaster Recovery
Graph Database
Introduction
Clauses
Functions
Advanced
Guide
Performance Tuning
Troubleshooting
Tools
Configuration Parameters
SQL Reference
The LIMIT clause restricts the number of records returned in the result set.
LIMIT accepts any expression that evaluates to a positive integer.
To return the top n rows of a result set, use the following syntax:
SELECT *
FROM cypher('graph_name', $$
MATCH (n) RETURN n.name
ORDER BY n.name
LIMIT 3
$$) AS (names agtype);
Returns the name property of matched vertices n, limited to three rows.
| names |
|---|
"A" |
"B" |
"C" |
| 3 rows |
LIMIT accepts any expression that evaluates to a positive integer, provided it does not reference external variables.
SELECT *
FROM cypher('graph_name', $$
MATCH (n)
RETURN n.name
ORDER BY n.name
LIMIT toInteger(3 * rand()) + 1
$$) AS (names agtype);
Returns one to three top-ranked rows.
| names |
|---|
"A" |
"B" |
| 2 rows |