A newer version of this documentation is available.

View Latest

N1QL Language Reference

The N1QL reference guide describes the N1QL language structure, syntax, and shows how to run N1QL queries from a command line. It also provides reference information about the basic elements in N1QL which can be combined to build N1QL statements.

N1QL Language Structure

The N1QL language structure is composed of statements, expressions, and comments.

Statements

N1QL statements are categorized into the following groups:

  • Data Definition Language (DDL) statements to create, modify, and delete indexes.

  • Data Manipulation Language (DML) statements to select from, insert, update, delete, and upsert data into JSON documents.

Expressions

The following are the different types of N1QL expressions:

  • literal-value

  • identifier

  • nested

  • case

  • logical

  • comparison

  • arithmetic

  • concatenation

  • construction

  • function call

  • subquery

  • collection

Comments

N1QL supports block comments. Here is the syntax:

/* [[text] | [newline]]+ */