IDs, Paths, Strings, and Keywords
this article provides reference information for the following /#identifiers /#path expressions /#string literals /#comments /#reserved keyword identifiers identifiers are the names of collections, documents, fields, and other database objects rules for identifiers rule guidelines examples case sensitivity identifiers are always case sensitive documentname documentname documentname non quoted identifiers must start with a letter (a z or a z) or an underscore can contain only letters, digits, and underscores invalid cannot use reserved keywords; for example 1abc ab $ c abc 4u abc abc123 quoted identifiers quote identifiers using backticks ( `` ) usage of double quotes ( "" ) is deprecated use any utf 8 character can be escaped inside existing delimiters `1abc` `ab$c` `a b` `a b` c `a ``b`` c` reserved identifiers the following table provides an overview of the dql specific restrictions that supersede common identifier rules element rule document identifier id is a reserved identifier for the document id all documents must have an assigned document id system collection identifiers double underscore ( ) i s a reserved identifier prefix for collections double underscore denotes a ditto system collection path expressions s ince ditto stores data as json like documents, you can use keypath indexing, known commonly as dot syntax , to navigate and reference specific parts of a ditto document when performing query operations in dql to separate a name in a path, use a dot ( ) for example, to navigate to the seats field in a select select statement select from collection cars (features map) where features seats = 'leather'{ " id" "123abc", "year" 2018, "vin" 123456, "features" { "speakers" 5 "seats" "leather" } } rules for path expressions following is an overview of the of the dql specific restrictions that supersede common rules topic guideline path evaluation path expressions are evaluated from left to right for example, a b c a is the leftmost name b is an intermediate name c is the rightmost name collections collection names cannot be present in path expressions types only register with nested json object and map types can be navigated with path expressions missing the path expression result is missing for the following conditions are both true the leftmost name and all intermediate names are a register with json object type or a map type the last name in the path does not exist string literals enclose string literals in single quotes ( '' ) in dql; f or example 'blue' dql select from cars where color = 'blue' double quotes ( "" ) cannot be not used to represent string literals within dql comments dql supports both inline and multi line comments inline comments inline comments are made using the operator dql this is an inline comment multi line comments multi line comments are inclosed by the / and / operator dql / this is a multi line comment / reserved keyword the following table provides a complete overview of the reserved keywords in dql against all alter analyze and anti any apply array array agg as asc at attachment between bigint binary blob boolean both by bytea case cast ceil century char character characters clob cluster collate collection conflict count counter cross current current date current time current timestamp date datetime day dec decade decimal default desc distinct distribute do documents double dow doy else end enum epoch error escape evict except exists expansion explain extract fail false fetch filter float floor following for from full group groups having hour id ilike in increment inherit initial inner insert int integer intersect interval into is isodow isoyear join julian language large lateral leading left like limit listagg localtime localtimestamp map mediumint microsecond microseconds millenium millennium millisecond milliseconds minute missing mode month nanosecond nanoseconds natural not nothing null numeric nvarchar object octets offset on operator or order outer outputformat over overflow overlay partition percent placing pncounter position preceding precision qualify quarter query range real regclass register reset returning right row rows safe cast second select semi set show similar smallint sort stcounter string substring system table temp temporary text then ties time timestamp timestamptz timetz timezone timezone hour timezone minute tinyint to tombstone top trailing trim true truncate try cast unbounded union unknown unlogged unnest unsigned update using uuid valid values varbinary varchar varying view week when where with within without xor year zone