String Functions List - Tutorialspoint

NEO4J CQL - STRING FUNCTIONS



Copyright ?

Like SQL, Neo4J CQL has provided a set of String functions to use them in CQL Queries to get

required results.

Here we are going to discuss some of the important and frequently used functions.

String Functions List

S.No.

Function

Description

1.

UPPER

It is used to change all letters into upper case letters.

2.

LOWER

It is used to change all letters into lower case letters.

3.

SUBSTRING

It is used to get substring of a given String.

4.

REPLACE

It is used to replace a substring with give substring of a String.

Now we will discuss each Neo4J CQL String Functions in detail with examples

UPPER

It takes a string as an input and convert into upper case letters. All CQL Functions should use ""

brackets.

Function syntax

UPPER ()

NOTE: may be a property name of a node or relationship from Neo4J Database.

Example This example demonstrates how to use CQL UPPER String function to retrieve Employee

node's Ename property details in upper case.

Step 1 - Type the below command at dollar prompt in Data Browser.

MATCH (e:Employee)

RETURN e.id,e.name,e.sal,e.deptno

Step 2 - Click on Execute button and observe the results.

We can observe that this query returns 4 rows.

Step 3 - Type the below command and click on Execute button.

MATCH (e:Employee)

RETURN e.id,UPPER(e.name),e.sal,e.deptno

It uses UPPER String function to print Employee name is upper case letters.

If we observe e.name column, all names are printed in upper case letters.

LOWER

It takes a string as an input and convert into lower case letters. All CQL Functions should use ""

brackets.

Function syntax

LOWER ()

NOTE: may be a property name of a node or relationship from Neo4J Database.

Example This example demonstrates how to use CQL LOWER String function to retrieve

Employee node's Ename property details in lower case.

Step 1 - Type the below command at dollar prompt in Data Browser.

MATCH (e:Employee)

RETURN e.id,e.name,e.sal,e.deptno

Step 2 - Click on Execute button and observe the results.

We can observe that this query returns 4 rows.

Step 3 - Type the below command and click on Execute button.

MATCH (e:Employee)

RETURN e.id,LOWER(e.name),e.sal,e.deptno

It uses LOWER String function to print Employee name is lower case letters.

If we observe e.name column, all names are printed in lower case letters.

SUBSTRING

It takes a string as an input and two indexes : one is start of the index and another is end of the

index and returns substring from StartInded to EndIndex-1. All CQL Functions should use ""

brackets.

Function syntax

SUBSTRING(, ,)

NOTE:In Neo4J CQL, if a string contains n letters, then it's length is n and index starts from 0 and ends at

n-1.

is index value to SUBSTRING function.

is optional. If we omit it, then it returns substring of the given string from startIndex to

end of the string.

Let us examine this with an example.

Example This example demonstrates how to retrieve first two letters of name property of all

Employee details.

Step 1 - Type the below command at dollar prompt in Data Browser.

MATCH (e:Employee)

RETURN e.id,e.name,e.sal,e.deptno

Step 2 - Click on Execute button and observe the results.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download