5 SQL Graph Queries
You can query a SQL property graph using the GRAPH_TABLE
        operator to express graph pattern matching queries.
               
Graph pattern matching allows you to define a set of path patterns and match it
            against a graph to obtain a set of solutions. You must provide the graph to be queried
            as an input to the GRAPH_TABLE operator along with the
                MATCH clause containing the graph patterns to be searched as
            shown:
               
SELECT * FROM GRAPH_TABLE (students_graph
  MATCH
  (a IS person) -[e IS friends]-> (b IS person WHERE b.name = 'Mary')
  WHERE a.name='John'
  COLUMNS (a.name AS person_a, b.name AS person_b)
);A basic SQL graph query is made up of the following components:
- FROMclause: It includes the- GRAPH_TABLEoperator which takes the input graph name as the first parameter.
- MATCHclause: It expresses the graph element patterns (vertex or edge pattern) to be searched on the SQL property graph. It can optionally include an element pattern- WHEREclause as seen in the preceding example (- (b IS person WHERE b.name = 'Mary')) query. This in-line- WHEREclause can access any matched variable.
- WHEREclause: This is an optional out-of-line- WHEREclause. Similar to the element pattern- WHEREclause, it has access to all the graph pattern variables and expresses a predicate that applies to the entire pattern in the- MATCHclause.
- COLUMNSclause: This contains the query output columns.
See Also:
GRAPH_TABLE Operator in Oracle Database SQL Language ReferenceThe following sections explain SQL graph queries in detail:
- About Graph Pattern
 TheGRAPH_TABLEoperator in a SQL graph query contains a graph pattern.
- Variable Length Path Patterns
 Variable length graph patterns provide advanced querying support for SQL property graphs.
- Complex Path Patterns
 You can query a SQL property graph using complex path patterns.
- Vertex and Edge Identifiers
 You can uniquely identify each vertex and edge in a SQL property graph with theVERTEX_IDandEDGE_IDoperators, respectively, in a SQL graph query.
- Using Aggregate Functions in SQL Graph Queries
 You can use aggregate functions in a SQL graph query to obtain an aggregated output.
- Running SQL Graph Queries at a Specific SCN
 You can run a SQL graph query at a given System Change Number (SCN) or timestamp value.
- Privileges to Query a SQL Property Graph
 You must have theREADorSELECTobject privilege to query a SQL property graph.
- Examples for SQL Graph Queries
 This section contains a few examples for querying a SQL property graph with fixed-length and variable-length graph pattern matching queries.
- Supported Features and Limitations for Querying a SQL Property Graph
 This section provides the list of supported and unsupported features for querying a SQL Property Graph.
- Tuning SQL Property Graph Queries
 You can tune a SQL graph query using theEXPLAIN PLANstatement.
- Type Compatibility Rules for Determining Property Types
 When using shared property names that are union compatible, the property type is determined by certain type compatibility rules.
- Viewing and Querying SQL Property Graphs Using SQL Developer
 Using SQL Developer 23.1, you can view all the SQL property graphs existing in your database schema by expanding SQL Property Graphs under the Property Graph node in the Connections navigator.
Parent topic: SQL Property Graphs