3.19. USE

The USE clause determines which graph a query, or query part, is executed against.

3.19.1. Introduction

The USE clause determines which graph a query, or query part, is executed against.

This functionality is currently only available in Neo4j Fabric. Find out more about this feature in Operations Manual → Fabric.

3.19.2. Syntax

The USE clause can only appear as the first clause of:

  • Queries:

    USE <graph>
    <other clauses>
  • Union parts:

    USE <graph>
    <other clauses>
      UNION
    USE <graph>
    <other clauses>
  • Subqueries:

    CALL {
      USE <graph>
      <other clauses>
    }

    In subqueries, a USE clause may appear as the second clause, if directly following an importing WITH clause

3.19.3. Examples

In the following examples we assume that we have configured a Fabric database called exampleFabricSetup.

3.19.3.1. Query graph by name

The graph that we wish to query is configured to be referred to by the name exampleDatabaseName.

Query. 

USE exampleFabricSetup.exampleDatabaseName

3.19.3.2. Query graph by graph ID

The graph we wish to query is configured with the graph id 0, which is why we can refer to it using the built-in function graph() with the argument 0:

Query. 

USE exampleFabricSetup.graph(0)