Skip to Content
CypherQueryMATCH Clause

MATCH Clause

Overview

The MATCH clause is used to search for patterns in the graph database. It allows you to specify node and relationship patterns that Cypher will use to find matching data structures. MATCH is typically used with WHERE to add constraints.

Examples

Basic node matching:

MATCH (p:Person) RETURN p.name

Relationship matching:

MATCH ()-[f:FOLLOWS]->() RETURN f

**Find followed relationships since 2000 **

MATCH (p:Person)-[f:FOLLOWS]->(q:Person) WHERE year(f.date) > 2000 RETURN p.name, f.date, q.name

Find followed in last 100 days

MATCH (p:Person)-[f:FOLLOWS]->(q:Person) WHERE date_diff('day', f.date, current_date()) >= 100 RETURN p.name, f.date, q.name
Last updated on