priyanka.sarkar
priyanka.sarkar

Reputation: 26498

Is it possible to have SQL Like Clause in Neo4J CQL?

At present the implementation is

MATCH (emp:Employee) 
WHERE emp.name = 'Abc'
RETURN emp

Is it possible to have a like clause e.g.

 MATCH (emp:Employee) 
WHERE emp.name Like %'Abc'%
RETURN emp

like the way we have in SQL ?

Upvotes: 5

Views: 3636

Answers (1)

Luanne
Luanne

Reputation: 19373

Yes, with a regular expression(see http://neo4j.com/docs/stable/query-where.html#query-where-regex)

MATCH (emp:Employee) 
WHERE emp.name =~ '.*Abc.*'
RETURN emp

or with CONTAINS (case sensitive) (see http://neo4j.com/docs/stable/query-where.html#query-where-string)

 MATCH (emp:Employee) 
 WHERE emp.name CONTAINS 'Abc'
 RETURN emp

CONTAINS is available in Neo4j 2.3.x

Upvotes: 9

Related Questions