Query Language Reference

Learn how to use SQL statements to update and query data in Oracle NoSQL Database Cloud Service.

The Oracle NoSQL Database uses the SQL query language to update and query data in NoSQL tables. See SQL Reference for Oracle NoSQL Database to learn the query language syntax.

Note:

The SQL Reference for Oracle NoSQL Database documents the SQL query language as supported by the on-premise Oracle NoSQL Database product. Oracle NoSQL Database Cloud Service supports only a subset of this functionality.

Typical Queries

SELECT <expression>
FROM <table name>
[WHERE <expression>]
[GROUP BY <expression>]
[ORDER BY <expression> [<sort order>]]
[OFFSET <number>]
[LIMIT <number>]; 

For example:
SELECT * FROM Users;
SELECT id, firstname, lastname FROM Users WHERE firstname = "Taylor";
UPDATE <table_name> [AS <table_alias>]
    <update_clause>[, <update_clause>]*
WHERE <expr>[<returning_clause>];

For example:
UPDATE JSONPersons $j
  SET TTL 1 DAYS
  WHERE id = 6
  RETURNING remaining_days($j) AS Expires;

Query Language Differences in the Cloud

The cloud service query support differs from what is described in the query language reference guide in the following way:

Exclusions

Joins are not available since child tables are not supported in Oracle NoSQL Database Cloud Service.

Restrictions on Expressions Used in the SELECT Clause

Oracle NoSQL Database Cloud Service supports grouping expressions or arithmetic expressions among aggregate functions. No other kinds of expressions are allowed in the SELECT clause. For example, CASE expressions are not allowed in the SELECT clause.

Each NoSQL Database driver provides an API to execute a query statement. To write your application and use query language, see Using Tables in Java.