What’s N1QL for Analytics?

This document is intended as a reference guide to the full syntax and semantics of the N1QL for Analytics Query Language, a SQL-inspired language for working with semistructured data. N1QL for Analytics is a Couchbase implementation, focused on parallel data analysis, of an emerging SQL-for-JSON query language specification called SQL++. N1QL for Analytics has much in common with SQL, but there are differences due to the data model that this language is designed to serve. (SQL was designed in the 1970s to interact with the flat, schematic world of relational databases, while N1QL for Analytics is designed for the nested, schemaless or schema-optional world of modern NoSQL systems.) In particular, N1QL for Analytics is intended for working with the JSON data model.

In what follows, we detail the features of the N1QL for Analytics language in a grammar-guided manner: we list and briefly explain each of the productions in the N1QL for Analytics grammar, offering examples (and results) for clarity.

For further information on SQL++, see SQL++ For SQL Users: A Tutorial by Don Chamberlin, which is available from Couchbase here.