A newer version of this documentation is available.

View Latest

Reserved Words

  • reference
    +
    N1QL defines an extensive list of keywords that are reserved words. You cannot use these keywords as identifiers unless you escape them. All of the N1QL keywords are case insensitive.

    Some of the keywords are not currently implemented but are reserved for future use.

    Using Reserved Words as Identifiers

    N1QL allows escaped identifiers to overlap with keywords. To use a reserved word as an identifier, you must escape it by enclosing the reserved word inside backticks (``). For example, if your JSON document contains a field named index, you can use it in your queries by escaping it like this:

    {
        "age": "42",
        "index": 27,
        "name": "Elvis"
    }
    CREATE INDEX myindex ON default(`index`) USING GSI;

    N1QL Reserved Words

    The following keywords are reserved and cannot be used as unescaped identifiers:

    ADVISE

    ALL

    ALTER

    ANALYZE

    AND

    ANY

    ARRAY

    AS

    ASC

    AT

    BEGIN

    BETWEEN

    BINARY

    BOOLEAN

    BREAK

    BUCKET

    BUILD

    BY

    CALL

    CASE

    CAST

    CLUSTER

    COLLATE

    COLLECTION

    COMMIT

    COMMITTED

    CONNECT

    CONTINUE

    CORRELATED

    COVER

    CREATE

    CURRENT

    DATABASE

    DATASET

    DATASTORE

    DECLARE

    DECREMENT

    DELETE

    DERIVED

    DESC

    DESCRIBE

    DISTINCT

    DO

    DROP

    EACH

    ELEMENT

    ELSE

    END

    EVERY

    EXCEPT

    EXCLUDE

    EXECUTE

    EXISTS

    EXPLAIN

    FALSE

    FETCH

    FILTER

    FIRST

    FLATTEN

    FLUSH

    FOLLOWING

    FOR

    FORCE

    FROM

    FTS

    FUNCTION

    GOLANG

    GRANT

    GROUP

    GROUPS

    GSI

    HASH

    HAVING

    IF

    ISOLATION

    IGNORE

    ILIKE

    IN

    INCLUDE

    INCREMENT

    INDEX

    INFER

    INLINE

    INNER

    INSERT

    INTERSECT

    INTO

    IS

    JAVASCRIPT

    JOIN

    KEY

    KEYS

    KEYSPACE

    KNOWN

    LANGUAGE

    LAST

    LEFT

    LET

    LETTING

    LEVEL

    LIKE

    LIMIT

    LSM

    MAP

    MAPPING

    MATCHED

    MATERIALIZED

    MERGE

    MINUS

    MISSING

    NAMESPACE

    NEST

    NL

    NO

    NOT

    NTH_VALUE

    NULL

    NULLS

    NUMBER

    OBJECT

    OFFSET

    ON

    OPTION

    OPTIONS

    OR

    ORDER

    OTHERS

    OUTER

    OVER

    PARSE

    PARTITION

    PASSWORD

    PATH

    POOL

    PRECEDING

    PREPARE

    PRIMARY

    PRIVATE

    PRIVILEGE

    PROBE

    PROCEDURE

    PUBLIC

    RANGE

    RAW

    REALM

    REDUCE

    RENAME

    RESPECT

    RETURN

    RETURNING

    REVOKE

    RIGHT

    ROLE

    ROLLBACK

    ROW

    ROWS

    SATISFIES

    SAVEPOINT

    SCHEMA

    SCOPE

    SELECT

    SELF

    SEMI

    SET

    SHOW

    SOME

    START

    STATISTICS

    STRING

    SYSTEM

    THEN

    TIES

    TO

    TRAN

    TRANSACTION

    TRIGGER

    TRUE

    TRUNCATE

    UNBOUNDED

    UNDER

    UNION

    UNIQUE

    UNKNOWN

    UNNEST

    UNSET

    UPDATE

    UPSERT

    USE

    USER

    USING

    VALIDATE

    VALUE

    VALUED

    VALUES

    VIA

    VIEW

    WHEN

    WHERE

    WHILE

    WINDOW

    WITH

    WITHIN

    WORK

    XOR