A newer version of this documentation is available.

View Latest

N1QL language structure

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


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 delete, insert, update, and upsert data into JSON documents.

  • Query statements to retrieve data


The following are the different types of N1QL expressions:

  • literal-value

  • identifier

  • nested

  • case

  • logical

  • comparison

  • arithmetic

  • concatenation

  • construction

  • function call

  • subquery

  • collection


N1QL supports block comments. Here is the syntax:

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