GraphQL Filter Specifications: QBE

While you can perform equality comparisons using GraphQL arguments, you can perform all other comparisons using the query-by-example (QBE) syntax.

QBE is analogous to where clause in SQL queries and is a slightly modified form of SODA QBE expression. To use this feature, you can specify the list of predicates for a table in the check clause or the where clause, and this clause is specified after the table name and before the list of directives.

For example, driver(check:{points:{_gt: 360}}) or driver(where:{points:{_gt: 360}}).

Note:

Starting 23.26.1, Oracle supports using either the check: keyword or the where: keyword to introduce QBE-style predicates in the GraphQL table function. In the context of GRAPHQL() table function, check and where are equivalent and both are used to filter the query results. (For JSON-relational duality view definitions, CHECK can have different semantics, such as enabling WITH CHECK OPTION behavior, while WHERE does not.)

Each predicate has the alias name for the column, followed by a QBE operator and then the comparison value. In the example above, points is the alias, _GT is the operator which will perform greater than operation and 360 is the comparison value, this is equivalent to "where points > 360".

Oracle AI Database supports the following categories of operators for GraphQL developers:
  • Relational Operators : Includes comparison operators such as _eq (equal to), _ne (not equal to) etc.
  • Logical Operators: Includes operators such as _and and _or to combine the predicates.
  • Item Method Operators: Includes operators such as _lower, _upper etc., which transforms the value and then uses for further filtering.