neo4j
  1. neo4j-skip-clause

Skip Clause - (Neo4j General Clauses)

The SKIP clause is used in the Cypher query language of Neo4j graph database to skip a specified number of rows before returning the result. It is often used in conjunction with the LIMIT clause to limit the number of rows returned by a query.

Syntax

The syntax for using the SKIP clause in a Cypher query is as follows:

MATCH (n)
SKIP <number>
RETURN n

where <number> specifies the number of rows to be skipped from the beginning of the result set.

Example

Consider a graph database with a "Person" node and "LIKES" relationship between them. To skip the first 3 persons and return the remaining persons, the Cypher query will be:

MATCH (p:Person)-[:LIKES]->()
RETURN p
SKIP 3

Output

The output of the SKIP clause in the Cypher query is to skip the specified number of rows from the beginning of the result set and return the remaining result set. It limits the number of rows returned in a query.

Explanation

The SKIP clause in the Cypher query is used to skip a specified number of rows and return the remaining rows. It helps in reducing the size of the result set returned. If you combine the SKIP clause with the LIMIT clause, you can efficiently paginate results and display them on different pages of an application.

Use

The Skip clause is used when we have to skip a certain number of rows to limit the result set we want to see. It is used in pagination along with the LIMIT clause to fetch records in chunks in an application.

Important Points

  • The SKIP clause is used to skip a specified number of rows from the start of the result set.
  • It helps in reducing the size of the result set returned by a query.
  • The SKIP clause is often used with the LIMIT clause to paginate results.

Summary

In summary, the SKIP clause in the Cypher query is used to skip a specified number of rows from the beginning of the result set and return the remaining result set. It helps in reducing the size of the result set returned and is often used in conjunction with the LIMIT clause. The SKIP clause is good for pagination in the application.

Published on: