Source: https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/dql/clauses/limit/ Documentation version: v5.3.2 # LIMIT clause The LIMIT clause specifies the maximum number of rows to return. ## Syntax diagramsource limit_clause ```` limit_clause ::= 'LIMIT' number_of_rows ```` ## Parameters ### `number_of_rows` A non-negative integer indicating the upper bound of the number of rows to be returned. If this bound is greater than or equal to the total number of rows, all rows are returned. Otherwise, the number of rows returned is no larger than this bound. ## Examples ### Limit with a number smaller than the total number of rows ```` ''' TABLE users TYPED TABLE {id INT, name STRING} = (199, "Julie Kavner"), (198, "Tom Cruise"), (197, "Amy Hasegawa") FOR r IN users RETURN r.id AS id, r.name AS name LIMIT 2 ''' ```` The preceding statement returns only the first 2 rows. Return: ```` +-----+--------------+ | id | name | +-----+--------------+ | 199 | Julie Kavner | | 198 | Tom Cruise | +-----+--------------+ ```` ### Limit with a number exceeding the total number of rows If the limit exceeds the total number of rows, all rows are returned. ```` ''' TABLE users TYPED TABLE {id INT, name STRING} = (199, "Julie Kavner"), (198, "Tom Cruise"), (197, "Amy Hasegawa") FOR r IN users RETURN r.id AS id, r.name AS name LIMIT 100 ''' ```` Return: ```` +-----+--------------+ | id | name | +-----+--------------+ | 199 | Julie Kavner | | 198 | Tom Cruise | | 197 | Amy Hasegawa | +-----+--------------+ ````