Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

neo4j

cypher

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 ?

like image 737
priyanka.sarkar Avatar asked Feb 22 '16 07:02

priyanka.sarkar


People also ask

Can Neo4j use SQL?

Neo4j recently released the BI Connector, which is a general JDBC driver that can process SQL queries against a Neo4j graph and return meaningful results. This enables users of tools like Tableau, that generate SQL queries, to plug directly into graphs.

What are the Neo4j CQL command?

Neo4j CQL has commands to perform Database operations. Neo4j CQL supports many clauses such as WHERE, ORDER BY, etc., to write very complex queries in an easy manner. Neo4j CQL supports some functions such as String, Aggregation. In addition to them, it also supports some Relationship Functions.

Which clause is used to search the data with a specified pattern in Neo4j?

The MATCH clause allows you to specify the patterns Neo4j will search for in the database.


1 Answers

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

like image 178
Luanne Avatar answered Oct 02 '22 20:10

Luanne