PageSourceSearch

https://cbl-reactnative.dev/assets/js/1146e852.93686b71.js

js cbl-reactnative.dev collected 2026-10-01 08:11:07 UTC 115,794 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkcbl_reactnative=self.webpackChunkcbl_reactnative||[]).push([[2773],{7201:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>t,contentTitle:()=>c,default:()=>o,frontMatter:()=>d,metadata:()=>r,toc:()=>a});const r=JSON.parse('{"id":"Queries/sqlplusplus","title":"SQL++ for Mobile","description":"Description - How to use SQL++ Query Strings to build effective queries with Couchbase Lite for React Native","source":"@site/versioned_docs/version-1.0/Queries/sqlplusplus.md","sourceDirName":"Queries","slug":"/Queries/sqlplusplus","permalink":"/1.0/Queries/sqlplusplus","draft":false,"unlisted":false,"editUrl":"https://github.com/couchbase/cbl-reactnative-docs/tree/main/versioned_docs/version-1.0/Queries/sqlplusplus.md","tags":[],"version":"1.0","sidebarPosition":1,"frontMatter":{"id":"sqlplusplus","sidebar_position":1},"sidebar":"tutorialSidebar","previous":{"title":"Queries","permalink":"/1.0/category/queries"},"next":{"title":"SQL++ for Mobile and Server Differences","permalink":"/1.0/Queries/sqlplusplus-mobile-and-server-differences"}}');var i=s(4848),l=s(8453);const d={id:"sqlplusplus",sidebar_position:1},c="SQL++ for Mobile",t={},a=[{value:"Introduction",id:"introduction",level:2},{value:"Running",id:"running",level:2},{value:"Example 1. Running a SQL++ Query",id:"example-1-running-a-sql-query",level:4},{value:"Query Format",id:"query-format",level:2},{value:"Example 2. Query Format",id:"example-2-query-format",level:4},{value:"Query Components",id:"query-components",level:3},{value:"SELECT Clause",id:"select-clause",level:2},{value:"Purpose",id:"purpose",level:3},{value:"Syntax",id:"syntax",level:3},{value:"Example 3. SQL++ Select Syntax",id:"example-3-sql-select-syntax",level:4},{value:"Arguments",id:"arguments",level:3},{value:"SELECT Wildcard",id:"select-wildcard",level:4},{value:"Table 1. Example Column Names for SELECT *",id:"table-1-example-column-names-for-select",level:4},{value:"Example",id:"example",level:3},{value:"Example 4. SELECT Examples",id:"example-4-select-examples",level:4},{value:"FROM Clause",id:"from-clause",level:2},{value:"Purpose",id:"purpose-1",level:3},{value:"Syntax",id:"syntax-1",level:3},{value:"Example 5. FROM Syntax",id:"example-5-from-syntax",level:4},{value:"Example",id:"example-1",level:3},{value:"Example 6. FROM Examples",id:"example-6-from-examples",level:4},{value:"JOIN Clause",id:"join-clause",level:2},{value:"Purpose",id:"purpose-2",level:3},{value:"Syntax",id:"syntax-2",level:3},{value:"Example 7. JOIN Syntax",id:"example-7-join-syntax",level:4},{value:"Arguments",id:"arguments-1",level:3},{value:"Example",id:"example-2",level:3},{value:"Example 8. JOIN Examples",id:"example-8-join-examples",level:4},{value:"Example 9. Using JOIN to Combine Document Details",id:"example-9-using-join-to-combine-document-details",level:4},{value:"WHERE Clause",id:"where-clause",level:2},{value:"Purpose",id:"purpose-3",level:3},{value:"Syntax",id:"syntax-3",level:3},{value:"Example 10. WHERE Syntax",id:"example-10-where-syntax",level:4},{value:"Arguments",id:"arguments-2",level:3},{value:"Example",id:"example-3",level:3},{value:"Example 11. WHERE Examples",id:"example-11-where-examples",level:4},{value:"GROUP BY Clause",id:"group-by-clause",level:2},{value:"Purpose",id:"purpose-4",level:3},{value:"Syntax",id:"syntax-4",level:3},{value:"Example 12. GROUP BY Syntax",id:"example-12-group-by-syntax",level:4},{value:"Arguments",id:"arguments-3",level:3},{value:"Example",id:"example-4",level:3},{value:"Example 13. GROUP BY Examples",id:"example-13-group-by-examples",level:4},{value:"ORDER BY Clause",id:"order-by-clause",level:2},{value:"Purpose",id:"purpose-5",level:3},{value:"Syntax",id:"syntax-5",level:3},{value:"Example 14. ORDER BY Syntax",id:"example-14-order-by-syntax",level:4},{value:"Arguments",id:"arguments-4",level:3},{value:"Example",id:"example-5",level:3},{value:"Example 15. ORDER BY Examples",id:"example-15-order-by-examples",level:4},{value:"LIMIT Clause",id:"limit-clause",level:2},{value:"Purpose",id:"purpose-6",level:3},{value:"Syntax",id:"syntax-6",level:3},{value:"Example 16. LINIT Syntax",id:"example-16-linit-syntax",level:4},{value:"Arguments",id:"arguments-5",level:3},{value:"Example",id:"example-6",level:3},{value:"Example 17. LIMIT Examples",id:"example-17-limit-examples",level:4},{value:"OFFSET Clause",id:"offset-clause",level:2},{value:"Purpose",id:"purpose-7",level:3},{value:"Syntax",id:"syntax-7",level:3},{value:"Example 18. OFFSET syntax",id:"example-18-offset-syntax",level:4},{value:"Arguments",id:"arguments-6",level:3},{value:"Example",id:"example-7",level:3}
1,{value:"Example 19. OFFSET Examples",id:"example-19-offset-examples",level:4},{value:"Expressions",id:"expressions",level:2},{value:"Literals",id:"literals",level:3},{value:"Boolean",id:"boolean",level:4},{value:"Purpose",id:"purpose-8",level:5},{value:"Syntax",id:"syntax-8",level:5},{value:"Example 20. Boolean Syntax",id:"example-20-boolean-syntax",level:4},{value:"Example",id:"example-8",level:5},{value:"Example 21. Boolean Examples",id:"example-21-boolean-examples",level:4},{value:"Numeric",id:"numeric",level:4},{value:"Purpose",id:"purpose-9",level:5},{value:"Syntax",id:"syntax-9",level:5},{value:"Example 22. Numeric Syntax",id:"example-22-numeric-syntax",level:4},{value:"Example",id:"example-9",level:5},{value:"Example 23. Numeric Examples",id:"example-23-numeric-examples",level:4},{value:"String",id:"string",level:4},{value:"Purpose",id:"purpose-10",level:5},{value:"Syntax",id:"syntax-10",level:5},{value:"Example 24. String Syntax",id:"example-24-string-syntax",level:4},{value:"Example",id:"example-10",level:5},{value:"Example 25. String Examples",id:"example-25-string-examples",level:4},{value:"NULL",id:"null",level:4},{value:"Purpose",id:"purpose-11",level:5},{value:"Syntax",id:"syntax-11",level:5},{value:"Example 26. NULL Syntax",id:"example-26-null-syntax",level:4},{value:"Example",id:"example-11",level:5},{value:"Example 27. NULL Examples",id:"example-27-null-examples",level:4},{value:"MISSING",id:"missing",level:4},{value:"Purpose",id:"purpose-12",level:5},{value:"Syntax",id:"syntax-12",level:5},{value:"Example 28. MISSING Syntax",id:"example-28-missing-syntax",level:4},{value:"Example",id:"example-12",level:5},{value:"Example 29. MISSING Examples",id:"example-29-missing-examples",level:4},{value:"Array",id:"array",level:4},{value:"Purpose",id:"purpose-13",level:5},{value:"Syntax",id:"syntax-13",level:5},{value:"Example 30. ARRAY Syntax",id:"example-30-array-syntax",level:4},{value:"Example",id:"example-13",level:5},{value:"Example 31. ARRAY examples",id:"example-31-array-examples",level:4},{value:"Dictionary",id:"dictionary",level:4},{value:"Purpose",id:"purpose-14",level:5},{value:"Syntax",id:"syntax-14",level:5},{value:"Example 32. Dictionary Syntax",id:"example-32-dictionary-syntax",level:4},{value:"Example",id:"example-14",level:5},{value:"Example 33. Dictionary Examples",id:"example-33-dictionary-examples",level:4},{value:"Identifier",id:"identifier",level:3},{value:"Purpose",id:"purpose-15",level:4},{value:"Syntax",id:"syntax-15",level:4},{value:"Example 34. Identifier Syntax",id:"example-34-identifier-syntax",level:4},{value:"Example",id:"example-15",level:4},{value:"Example 35. Identifier Examples",id:"example-35-identifier-examples",level:4},{value:"Property Expression",id:"property-expression",level:3},{value:"Purpose",id:"purpose-16",level:4},{value:"Syntax",id:"syntax-16",level:4},{value:"Example 36. Property Expression Syntax",id:"example-36-property-expression-syntax",level:4},{value:"Example",id:"example-16",level:4},{value:"Example 37. Property Expressions Examples",id:"example-37-property-expressions-examples",level:4},{value:"Any and Every Expression",id:"any-and-every-expression",level:3},{value:"Purpose",id:"purpose-17",level:4},{value:"Syntax",id:"syntax-17",level:4},{value:"Example 38. Any and Every Expression Syntax",id:"example-38-any-and-every-expression-syntax",level:4},{value:"Example",id:"example-17",level:4},{value:"Example 39. Any and Every Expression Examples",id:"example-39-any-and-every-expression-examples",level:4},{value:"Parameter Expression",id:"parameter-expression",level:3},{value:"Purpose",id:"purpose-18",level:4},{value:"Syntax",id:"syntax-18",level:4},{value:"Example 40. Parameter Expression Syntax",id:"example-40-parameter-expression-syntax",level:4},{value:"Example",id:"example-18",level:4},{value:"Example 41. Parameter Expression Examples",id:"example-41-parameter-expression-examples",level:4},{value:"Example 42. Using a Parameter",id:"example-42-using-a-parameter",level:4},{value:"Parenthesis Expression",id:"parenthesis-expression",level:3},{value:"Purpose",id:"purpose-19",level:4},{value:"Example",id:"example-19",level:4},{value:"Example 43. Parenthesis Expression Examples",id:"example-43-parenthesis-expression-examples",level:4},{value:"Operators",id:"operators",level:2},{value:"Binary Operators",id:"binary-operators",level:3},{value:"Maths",id:"maths",level:4},{value:"Table 2. Maths Operators",id:"table-2-maths-operators",level:4},{value:"Comparison Operators",id:"comparison-operators",level:4},{value:"Purpose",id:"purpose-20",level:5},{value:"Table 3. Comparison Operators",id:"table-3-comparison-operators",level:4},{value:"Table 4. Comparing NULL and MISSING values using IS",id:"table-4-comparing-null-and-missing-values-using-is",level:4},{value:"Logical Operators",id:"logical-operators",level:4},{value:"Purpose",id:"purpose-21",level:5},{value:"Table 5. Logical Operators",id:"table-5-logical-operators",level:4},{value:"Table 6. Logical Operators Table",id:"table-6-logical-operators-table",level:4},{value:"String Operators",id:"string-operators",level:4},{value:"Purpose",id:"purpose-22",level:5},{value:"Table 7. String Operators",id:"table-7-string-operators",level:4},{value:"Unary Operators",id:"unary-operators",level:3},{value:"Purpose",id:"purpose-23",level:4},{value:"Syntax",id:"syntax-19",level:4},{value:"Example 44. Unary Operators Syntax",id:"example-44-unary-operators-syntax",level:4},{value:"Table 8. Unary Operators",id:"table-8-unary-operators",level:4},{value:"Table 9. NOT Operators",id:"table-9-not-operators",level:4},{value:"<code>COLLATE</code> Operator",id:"collate-operator",level:3},{value:"Purpose",id:"purpose-24",level:4},{value:"Usage",id:"usage",level:4},{value:"Syntax",id:"syntax-20",level:4},{value:"Example 45. COLLATE Operator Syntax",id:"example-45-collate-operator-syntax",level:4},{value:"Arguments",id:"arguments-7",level:4},{value:"Example",id:"example-20",level:4},{value:"Example 46. COLLATE Operator Example",id:"example-46-collate-operator-example",level:4},{value:"Conditional Operator",id:"conditional-operator",level:3},{value:"Purpose",id:"purpose-25",level:4},{value:"Syntax",id:"syntax-21",level:4},{value:"Example 47. Conditional Operators Syntax",id:"example-47-conditional-operators-syntax",level:4},{value:"Examples",id:"examples",level:4},{value:"Example 48. Simple Case",id:"example-48-simple-case",level:4},{value:"Examples",id:"examples-1",level:4},{value:"Example 49. Searched Case",id:"example-49-searched-case",level:4},{value:"Functions",id:"functions",level:2},{value:"Purpose",id:"purpose-26",level:3},{value:"Syntax",id:"syntax-22",level:3},{value:"Example 50. Functions Syntax",id:"example-50-functions-syntax",level:4},{value:"Aggregation Functions",id:"aggregation-functions",level:3},{value:"Table 10. Aggregation Functions",id:"table-10-aggregation-functions",level:4},{value:"Array Functions",id:"array-functions",level:3},{value:"Table 11. Array Functions",id:"table-11-array-functions",level:4},{value:"Conditional Functions",id:"conditional-functions",level:3},{value:"Table 12. Conditional Functions",id:"table-12-conditional-functions",level:4},{value:"Date and Time Functions",id:"date-and-time-functions",level:3},{value:"Table 13. Date and Time Functions",id:"table-13-date-and-time-functions",level:4},{value:"Full Text Search Functions",id:"full-text-search-functions",level:3},{value:"Table 14. FTS Functions",id:"table-14-fts-functions",level:4},{value:"Maths Functions",id:"maths-functions",level:3},{value:"Table 15. Maths Functions",id:"table-15-maths-functions",level:4},{value:"Pattern Searching Functions",id:"pattern-searching-functions",level:3},{value:"Table 16. Pattern Searching Functions",id:"table-16-pattern-searching-functions",level:4},{value:"String Functions",id:"string-functions",level:3},{value:"Table 17. String Functions",id:"table-17-string-functions",level:4},{value:"Type Checking Functions",id:"type-checking-functions",level:3},{value:"Table 18. Type Checking Functions",id:"table-18-type-checking-functions",level:4},{value:"Type Conversion Functionsunctions",id:"type-conversion-functionsunctions",level:3},{value:"Table 19. Type Conversion Functions",id:"table-19-type-conversion-functions",level:4}
1,{value:"QueryBuilder Differences",id:"querybuilder-differences",level:2},{value:"Table 20. QueryBuilder Differences",id:"table-20-querybuilder-differences",level:4},{value:"Query Parameters",id:"query-parameters",level:2},{value:"Example 51. Running a SQL++ Query",id:"example-51-running-a-sql-query",level:4}];function h(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",br:"br",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,l.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.header,{children:(0,i.jsx)(n.h1,{id:"sql-for-mobile",children:"SQL++ for Mobile"})}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["Description - ",(0,i.jsx)(n.em,{children:"How to use SQL++ Query Strings to build effective queries with Couchbase Lite for React Native"}),(0,i.jsx)(n.br,{}),"\n","Related Content - ",(0,i.jsx)(n.a,{href:"/1.0/Queries/live-queries",children:"Live Queries"})," | ",(0,i.jsx)(n.a,{href:"/1.0/indexes",children:"Indexes"})]}),"\n"]}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsx)(n.p,{children:"N1QL is Couchbase's implementation of the developing SQL++ standard. As such the terms N1QL and SQL++ are used interchangeably in all Couchbase documentation unless explicitly stated otherwise."})}),"\n",(0,i.jsx)(n.h2,{id:"introduction",children:"Introduction"}),"\n",(0,i.jsxs)(n.p,{children:["Developers using Couchbase Lite for React Native can provide SQL++ query strings using the SQL++ Query API. This API uses query statements of the form shown in ",(0,i.jsx)(n.a,{href:"#example-1-running-a-sql-query",children:"Example 1"}),". The structure and semantics of the query format are based on that of Couchbase Server's SQL++ query language - see ",(0,i.jsx)(n.a,{href:"https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/index.html",children:"SQL++ Reference Guide"})," and ",(0,i.jsx)(n.a,{href:"https://docs.couchbase.com/server/current/learn/data/n1ql-versus-sql.html",children:"SQL++ Data Model"}),"."]}),"\n",(0,i.jsx)(n.h2,{id:"running",children:"Running"}),"\n",(0,i.jsxs)(n.p,{children:["Use ",(0,i.jsx)(n.code,{children:"Database.createQuery"})," to define a query through an SQL++ string. Then run the query using the ",(0,i.jsx)(n.code,{children:"Query.execute()"})," method."]}),"\n",(0,i.jsx)(n.h4,{id:"example-1-running-a-sql-query",children:"Example 1. Running a SQL++ Query"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"const query = database.createQuery('SELECT META().id AS thisId FROM inventory.hotel WHERE city=\"Medway\"');\nconst resultSet = await query.execute();\n"})}),"\n",(0,i.jsx)(n.h2,{id:"query-format",children:"Query Format"}),"\n",(0,i.jsxs)(n.p,{children:["The API uses query statements of the form shown in ",(0,i.jsx)(n.a,{href:"#example-2-query-format",children:"Example 2"}),"."]}),"\n",(0,i.jsx)(n.h4,{id:"example-2-query-format",children:"Example 2. Query Format"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:"SELECT ____\nFROM ____\nJOIN ____\nWHERE ____\nGROUP BY ____\nORDER BY ____\nLIMIT ____\nOFFSET ____\n"})}),"\n",(0,i.jsx)(n.h3,{id:"query-components",children:"Query Components"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"SELECT"})," clause specifies the data to be returned in the result set."]}),"\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"FROM"})," clause specifies the collection to query the documents from."]}),"\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"JOIN"})," clause specifies the criteria for joining multiple documents."]}),"\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"WHERE"})," clause specifies the query criteria. The ",(0,i.jsx)(n.code,{children:"SELECT"}),"ed properties of documents matching this criteria will be returned in the result set."]}),"\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"GROUP BY"})," clause specifies the criteria used to group returned items in the result set."]}),"\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"ORDER BY"})," clause specifies the criteria used to order the items in the result set."]}),"\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"LIMIT"})," clause specifies the maximum number of results to be returned."]}),"\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"OFFSET"})," clause specifies the number of results to be skipped before starting to return results."]}),"\n"]}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["We recommend working through the ",(0,i.jsx)(n.a,{href:"https://query-tutorial.couchbase.com/tutorial/#1",children:"SQL++ Tutorials"})," as a good way to build your SQL++ skills."]})}),"\n",(0,i.jsx)(n.h2,{id:"select-clause",children:"SELECT Clause"}),"\n",(0,i.jsx)(n.h3,{id:"purpose",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Projects the result returned by the query, identifying the columns it will contain."}),"\n",(0,i.jsx)(n.h3,{id:"syntax",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-3-sql-select-syntax",children:"Example 3. SQL++ Select Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:"select        = SELECT _ ( ( DISTINCT | ALL ) _ )? selectResults\nselectResults = selectResult ( _? ',' _? selectResult )*\nselectResult  = expression ( ( _ AS )? _ columnAlias )?\ncolumnAlias   = IDENTIFIER\n"})}),"\n",(0,i.jsx)(n.h3,{id:"arguments",children:"Arguments"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["The select clause begins with the ",(0,i.jsx)(n.code,{children:"SELECT"})," keyword."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["The optional ",(0,i.jsx)(n.code,{children:"ALL"})," argument is used to specify that the query should return ",(0,i.jsx)(n.code,{children:"ALL"})," results (the default)."]}),"\n",(0,i.jsxs)(n.li,{children:["The optional ",(0,i.jsx)(n.code,{children:"DISTINCT"})," argument is used to specify that the query should return distinct results."]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"selectResults"})," is a list of columns projected in the query result. Each column is an expression which could be a property expression or any expression or function. You can use the ",(0,i.jsx)(n.code,{children:"*"}
1)," expression, to select all columns."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["Use the optional ",(0,i.jsx)(n.code,{children:"AS"})," argument to provides an alias for a column. Each column can be aliased by putting the alias name after the column name."]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.h4,{id:"select-wildcard",children:"SELECT Wildcard"}),"\n",(0,i.jsxs)(n.p,{children:["When using the ",(0,i.jsx)(n.code,{children:"*"})," expression, the column name is one of:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"The alias name, if one was specified."}),"\n",(0,i.jsxs)(n.li,{children:["The data source name(or its alias if provided) as specified in the ",(0,i.jsx)(n.a,{href:"https://cbl-dart.dev/queries/sqlplusplus-mobile/#from-clause",children:"FROM clause"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["This behavior is inline with that of SQL++ for Server - see example in ",(0,i.jsx)(n.a,{href:"#table-1-example-column-names-for-select",children:"Table 1"}),"."]}),"\n",(0,i.jsx)(n.h4,{id:"table-1-example-column-names-for-select",children:"Table 1. Example Column Names for SELECT *"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Query"}),(0,i.jsx)(n.th,{children:"Column Name"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"SELECT * AS data FROM _"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"data"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"SELECT * FROM _"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"_"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"SELECT * FROM _default"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"_default"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"SELECT * FROM users"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"users"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"SELECT * FROM users AS user"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"user"})})]})]})]}),"\n",(0,i.jsx)(n.h3,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-4-select-examples",children:"Example 4. SELECT Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:"SELECT * ...;\nSELECT user.* AS data ...;\nSELECT name fullName ...;\nSELECT user.name ...;\nSELECT DISTINCT address.city ...;\n"})}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["Use the ",(0,i.jsx)(n.code,{children:"*"})," expression to select all columns."]}),"\n",(0,i.jsxs)(n.li,{children:["Select all properties from the ",(0,i.jsx)(n.code,{children:"user"})," data source. Give the object an alias of ",(0,i.jsx)(n.code,{children:"data"}),"."]}),"\n",(0,i.jsx)(n.li,{children:"Select a pair of properties."}),"\n",(0,i.jsxs)(n.li,{children:["Select a specific property from the ",(0,i.jsx)(n.code,{children:"user"})," data source."]}),"\n",(0,i.jsxs)(n.li,{children:["Select the property ",(0,i.jsx)(n.code,{children:"city"})," from the ",(0,i.jsx)(n.code,{children:"address"})," data source."]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"from-clause",children:"FROM Clause"}),"\n",(0,i.jsx)(n.h3,{id:"purpose-1",children:"Purpose"}),"\n",(0,i.jsxs)(n.p,{children:["Specifies the data source and optionally applies an alias (",(0,i.jsx)(n.code,{children:"AS"}),"). It is mandatory."]}),"\n",(0,i.jsx)(n.h3,{id:"syntax-1",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-5-from-syntax",children:"Example 5. FROM Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:"from             = FROM _ dataSource\ndataSource       = collectionName ( ( _ AS )? _ collectionAlias )?\ncollectionName   = IDENTIFIER\ncollectionAlias  = IDENTIFIER\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Here ",(0,i.jsx)(n.code,{children:"dataSource"})," is the collection name against which the query is to run. Use ",(0,i.jsx)(n.code,{children:"AS"})," to give the collection an alias you can use within the query. To use the default collection, without specifying a name, use ",(0,i.jsx)(n.code,{children:"_"})," as the data source."]}),"\n",(0,i.jsx)(n.h3,{id:"example-1",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-6-from-examples",children:"Example 6. FROM Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:"SELECT name FROM testScope.user;
1\nSELECT user.name FROM testScope.users AS user;\nSELECT user.name FROM testScope.users user;\n-- These queries use the default scope and default collection (_default._default) in Couchbase.\nSELECT name FROM _default._default;\nSELECT user.name FROM _default._default AS user;\nSELECT user.name FROM _default._default user;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"join-clause",children:"JOIN Clause"}),"\n",(0,i.jsx)(n.h3,{id:"purpose-2",children:"Purpose"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"JOIN"})," clause enables you to select data from multiple data sources linked by criteria specified in the ON constraint. Currently only self-joins are supported. For example to combine airline details with route details, linked by the airline id - see Example 7."]}),"\n",(0,i.jsx)(n.h3,{id:"syntax-2",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-7-join-syntax",children:"Example 7. JOIN Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:"join            = joinOperator _ dataSource ( _ constraint )?\njoinOperator    = ( ( LEFT ( _ OUTER )? | INNER | CROSS ) _ )? JOIN\ndataSource      = collectionName ( ( _ AS )? _ collectionAlias )?\nconstraint      = ON _ expression\ncollectionName  = IDENTIFIER\ncollectionAlias = IDENTIFIER\n"})}),"\n",(0,i.jsx)(n.h3,{id:"arguments-1",children:"Arguments"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"JOIN"})," clause starts with a ",(0,i.jsx)(n.code,{children:"JOIN"})," operator followed by the data source."]}),"\n",(0,i.jsxs)(n.li,{children:["Five ",(0,i.jsx)(n.code,{children:"JOIN"})," operators are supported:","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"JOIN"}),", ",(0,i.jsx)(n.code,{children:"LEFT JOIN"}),", ",(0,i.jsx)(n.code,{children:"LEFT OUTER JOIN"}),", ",(0,i.jsx)(n.code,{children:"INNER JOIN"}),", and ",(0,i.jsx)(n.code,{children:"CROSS JOIN"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["Note: ",(0,i.jsx)(n.code,{children:"JOIN"})," and ",(0,i.jsx)(n.code,{children:"INNER JOIN"})," are the same, and ",(0,i.jsx)(n.code,{children:"LEFT JOIN"})," and ",(0,i.jsx)(n.code,{children:"LEFT OUTER JOIN"})," are the same."]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"JOIN"})," constraint starts with the ",(0,i.jsx)(n.code,{children:"ON"})," keyword followed by the expression that defines the joining constraints."]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"example-2",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-8-join-examples",children:"Example 8. JOIN Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:"SELECT users.prop1, other.prop2\nFROM testScope.users\nJOIN users AS other ON users.key = other.key;\n\nSELECT users.prop1, other.prop2\nFROM testScope.users\nLEFT JOIN users AS other ON users.key = other.key;\n"})}),"\n",(0,i.jsx)(n.h4,{id:"example-9-using-join-to-combine-document-details",children:"Example 9. Using JOIN to Combine Document Details"}),"\n",(0,i.jsxs)(n.p,{children:["This example joins the documents from the ",(0,i.jsx)(n.code,{children:"routes"})," collections with documents from the ",(0,i.jsx)(n.code,{children:"airlines"})," collection using the document ID (",(0,i.jsx)(n.code,{children:"id"}),") of the ",(0,i.jsx)(n.em,{children:"airline"})," document and the ",(0,i.jsx)(n.code,{children:"airlineId"})," property of the ",(0,i.jsx)(n.em,{children:"route"})," document."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:'SELECT *\nFROM inventory.routes r\nJOIN airlines a ON r.airlineId = META(a).id\nWHERE a.country = "France";\n'})}),"\n",(0,i.jsx)(n.h2,{id:"where-clause",children:"WHERE Clause"}),"\n",(0,i.jsx)(n.h3,{id:"purpose-3",children:"Purpose"}),"\n",(0,i.jsxs)(n.p,{children:["Specifies the selection criteria used to filter results. As with SQL, use the ",(0,i.jsx)(n.code,{children:"WHERE"})," clause to choose which results are returned by your query."]}),"\n",(0,i.jsx)(n.h3,{id:"syntax-3",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-10-where-syntax",children:"Example 10. WHERE Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:"where = WHERE _ expression\n"})}),"\n",(0,i.jsx)(n.h3,{id:"arguments-2",children:"Arguments"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"WHERE"})," evalates the expression to a ",(0,i.jsx)(n.code,{children:"BOOLEAN"})," value. You can combine any number of expressions through logical operators, in order to implement sophisticated filtering capabilities."]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"example-3",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-11-where-examples",children:"Example 11. WHERE Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:'SELECT name\nFROM testScope.employees\nWHERE department = "engineer" AND group = "mobile"\n'})}),"\n",(0,i.jsx)(n.h2,{id:"group-by-clause",children:"GROUP BY Clause"}),"\n",(0,i.jsx)(n.h3,{id:"purpose-4",children:"Purpose"}),"\n",(0,i.jsxs)(n.p,{children:["Use ",(0,i.jsx)(n.code,{children:"GROUP BY"})," to group results for aggreation, based on one or more expressions."]}),"\n",(0,i.jsx)(n.h3,{id:"syntax-4",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-12-group-by-syntax",children:"Example 12. GROUP BY Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:"groupBy  = grouping ( _ having )?\ngrouping = GROUP BY _ expression ( _? ',' _? expression )*\nhaving   = HAVING _ expression\n"})}),"\n",(0,i.jsx)(n.h3,{id:"arguments-3",children:"Arguments"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"GROUP BY"})," clause starts with the ",(0,i.jsx)(n.code,{children:"GROUP BY"})," keyword followed by one or more expressions."]}),"\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"GROUP BY"})," clause is normally used together with aggregate functions (e.g. ",(0,i.jsx)(n.code,{children:"COUNT"}),", ",(0,i.jsx)(n.code,{children:"MAX"}),", ",(0,i.jsx)(n.code,{children:"MIN"}),", ",(0,i.jsx)(n.code,{children:"SUM"}),", ",(0,i.jsx)(n.code,{children:"AVG"}),")."]}),"\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"HAVING"})," clause allows you to filter the results based on aggregate functions - for example, ",(0,i.jsx)(n.code,{children:"HAVING COUNT(airlineId) > 100"}),"."]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"example-4",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-13-group-by-examples",children:"Example 13. GROUP BY Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:'SELECT COUNT(airlineId), destination\nFROM inventory.routes\nGROUP BY destination;\n\nSELECT COUNT(airlineId), destination\nFROM inventory.routes\nGROUP BY destination\nHAVING COUNT(airlineId) > 100;\n\nSELECT COUNT(airlineId), destination\nFROM inventory.routes\nWHERE destinationState = "CA"\nGROUP BY destination\nHAVING COUNT(airlineId) > 100;\n'})}),"\n",(0,i.jsx)(n.h2,{id:"order-by-clause",children:"ORDER BY Clause"}),"\n",(0,i.jsx)(n.h3,{id:"purpose-5",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Sort query results based on a expression."}),"\n",(0,i.jsx)(n.h3,{id:"syntax-5",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-14-order-by-syntax",children:"Example 14. ORDER BY Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:"orderBy  = ORDER BY _ ordering ( _? ',' _? ordering )*\nordering = expression ( _ order )?\norder    = ( ASC | DESC )\n"})}),"\n",(0,i.jsx)(n.h3,{id:"arguments-4",children:"Arguments"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"ORDER BY"})," clause starts with the ",(0,i.jsx)(n.code,{children:"ORDER BY"})," keyword followed by one or more ordering expressions."]}),"\n",(0,i.jsx)(n.li,{children:"An ordering expression specifies an expressions to use for ordering the results."}),"\n",(0,i.jsxs)(n.li,{children:["For each ordering expression, the sorting direction can be specified using the optional ",(0,i.jsx)(n.code,{children:"ASC"})," (ascending) or ",(0,i.jsx)(n.code,{children:"DESC"})," (descending) directives. Default is ",(0,i.jsx)(n.code,{children:"ASC"}),"."]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"example-5",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-15-order-by-examples",children:"Example 15. ORDER BY Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:"SELECT name\nFROM testScope.users\nORDER BY name;\n\nSELECT name\nFROM testScope.users\nORDER BY name DESC;\n\nSELECT name, score\nFROM testScope.users\nORDER BY name ASC, score DESC;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"limit-clause",children:"LIMIT Clause"}),"\n",(0,i.jsx)(n.h3,{id:"purpose-6",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Specifies the maximum number of results to be returned by the query."}),"\n",(0,i.jsx)(n.h3,{id:"syntax-6",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-16-linit-syntax",children:"Example 16. LINIT Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:"limit = LIMIT _ expression\n"})}),"\n",(0,i.jsx)(n.h3,{id:"arguments-5",children:"Arguments"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"LIMIT"})," clause starts with the ",(0,i.jsx)(n.code,{children:"LIMIT"})," keyword followed by an expression that will be evaluated as a number."]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"example-6",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-17-limit-examples",children:"Example 17. LIMIT Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-SQL",children:"SELECT name\nFROM testScope.users\nLIMIT 10;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"offset-clause",children:"OFFSET Clause"}),"\n",(0,i.jsx)(n.h3,{id:"purpose-7",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Specifies the number of results to be skipped by the query."}),"\n",(0,i.jsx)(n.h3,{id:"syntax-7",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-18-offset-syntax",children:"Example 18. OFFSET syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"offset = OFFSET _ expression\n"})}),"\n",(0,i.jsx)(n.h3,{id:"arguments-6",children:"Arguments"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["The offset clause starts with the ",(0,i.jsx)(n.code,{children:"OFFSET"})," keyword followed by an expression\nthat will be evaluated as a number that represents the number of results to\nbe skipped before the query begins returning results."]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"example-7",children:"Example"}
1),"\n",(0,i.jsx)(n.h4,{id:"example-19-offset-examples",children:"Example 19. OFFSET Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT name\nFROM testScope.users\nOFFSET 10;\n\nSELECT name\nFROM testScope.users\nLIMIT 10\nOFFSET 10;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"expressions",children:"Expressions"}),"\n",(0,i.jsxs)(n.p,{children:["An expression is a specification for a value that is resolved when executing a\nquery. This section, together with ",(0,i.jsx)(n.a,{href:"#operators",children:"Operators"})," and\n",(0,i.jsx)(n.a,{href:"#functions",children:"Functions"}),", which are covered in their own sections, covers all the\navailable types of expressions."]}),"\n",(0,i.jsx)(n.h3,{id:"literals",children:"Literals"}),"\n",(0,i.jsx)(n.h4,{id:"boolean",children:"Boolean"}),"\n",(0,i.jsx)(n.h5,{id:"purpose-8",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Represents a true or false value."}),"\n",(0,i.jsx)(n.h5,{id:"syntax-8",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-20-boolean-syntax",children:"Example 20. Boolean Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"boolean = ( TRUE | FALSE )\n"})}),"\n",(0,i.jsx)(n.h5,{id:"example-8",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-21-boolean-examples",children:"Example 21. Boolean Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT value\nFROM testScope.testCollection\nWHERE value = true;\n\nSELECT value\nFROM testScope.testCollection\nWHERE value = false;\n"})}),"\n",(0,i.jsx)(n.h4,{id:"numeric",children:"Numeric"}),"\n",(0,i.jsx)(n.h5,{id:"purpose-9",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Represents a numeric value. Numbers may be signed or unsigned digits. They have\noptional fractional and exponent components."}),"\n",(0,i.jsx)(n.h5,{id:"syntax-9",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-22-numeric-syntax",children:"Example 22. Numeric Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"numeric = -? ( ( . digit+ ) | ( digit+ ( . digit* )? ) ) ( ( E | e ) ( - | + )? digit+ )?\ndigit   = /[0-9]/\n"})}),"\n",(0,i.jsx)(n.h5,{id:"example-9",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-23-numeric-examples",children:"Example 23. Numeric Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT\n  10,\n  0,\n  -10,\n  10.25,\n  10.25e2,\n  10.25E2,\n  10.25E+2,\n  10.25E-2\nFROM testScope.testCollection;\n"})}),"\n",(0,i.jsx)(n.h4,{id:"string",children:"String"}),"\n",(0,i.jsx)(n.h5,{id:"purpose-10",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"The string literal represents a string or sequence of characters."}),"\n",(0,i.jsx)(n.h5,{id:"syntax-10",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-24-string-syntax",children:"Example 24. String Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"string         = ( \" character* \" | ' character* ' )\ncharacter      = ( escapeSequence | any codepoint except \", ' or control characters )\nescapeSequence = \\ ( \" | ' | \\ | / | b | f | n | r | t | u hex hex hex hex )\nhex            = hexDigit hexDigit\nhexDigit       = /[0-9a-fA-F]/\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"note",children:(0,i.jsx)(n.p,{children:"The string literal can be double-quoted as well as single-quoted."})}),"\n",(0,i.jsx)(n.h5,{id:"example-10",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-25-string-examples",children:"Example 25. String Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT firstName, lastName\nFROM crm.customer\nWHERE contact.middleName = \"middle\" AND contact.lastName = 'last';\n"})}),"\n",(0,i.jsx)(n.h4,{id:"null",children:"NULL"}),"\n",(0,i.jsx)(n.h5,{id:"purpose-11",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Represents the absence of a value."}),"\n",(0,i.jsx)(n.h5,{id:"syntax-11",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-26-null-syntax",children:"Example 26. NULL Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"null = NULL\n"})}),"\n",(0,i.jsx)(n.h5,{id:"example-11",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-27-null-examples",children:"Example 27. NULL Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT firstName, lastName\nFROM crm.customer\nWHERE contact.middleName IS NULL;\n"})}),"\n",(0,i.jsx)(n.h4,{id:"missing",children:"MISSING"}),"\n",(0,i.jsx)(n.h5,{id:"purpose-12",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Represents a missing name-value pair in a dictionary."}),"\n",(0,i.jsx)(n.h5,{id:"syntax-12",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-28-missing-syntax",children:"Example 28. MISSING Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"missing = MISSING\n"})}),"\n",(0,i.jsx)(n.h5,{id:"example-12",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-29-missing-examples",children:"Example 29. MISSING Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT firstName, lastName\nFROM crm.customer\nWHERE contact.middleName IS MISSING;\n"})}),"\n",(0,i.jsx)(n.h4,{id:"array",children:"Array"}),"\n",(0,i.jsx)(n.h5,{id:"purpose-13",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Represents an array."}),"\n",(0,i.jsx)(n.h5,{id:"syntax-13",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-30-array-syntax",children:"Example 30. ARRAY Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"array = [ ( _? expression ( _? ',' _? expression )* _? )? ]\n"})}),"\n",(0,i.jsx)(n.h5,{id:"example-13",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-31-array-examples",children:"Example 31. ARRAY examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:'SELECT ["a", "b", "c"]\nFROM testScope.testCollection\n\nSELECT [property1, property2, property3]\nFROM testScope.testCollection\n'})}),"\n",(0,i.jsx)(n.h4,{id:"dictionary",children:"Dictionary"}),"\n",(0,i.jsx)(n.h5,{id:"purpose-14",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Represents a dictionary."}),"\n",(0,i.jsx)(n.h5,{id:"syntax-14",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-32-dictionary-syntax",children:"Example 32. Dictionary Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"dictionary = { ( _? string _? : _? expression ( _? , _? string _? : _? expression )* _? )? }\n"})}),"\n",(0,i.jsx)(n.h5,{id:"example-14",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-33-dictionary-examples",children:"Example 33. Dictionary Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT { 'name': 'James', 'department': 10 }\nFROM testScope.testCollection;\n\nSELECT { 'name': 'James', 'department': dept }\nFROM testScope.testCollection;
1\n\nSELECT { 'name': 'James', 'phones': ['650-100-1000', '650-100-2000'] }\nFROM testScope.testCollection;\n"})}),"\n",(0,i.jsx)(n.h3,{id:"identifier",children:"Identifier"}),"\n",(0,i.jsx)(n.h4,{id:"purpose-15",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"An identifier references an entity by its symbolic name. Use an identifier for\nexample to identify:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Column alias names"}),"\n",(0,i.jsx)(n.li,{children:"Database names"}),"\n",(0,i.jsx)(n.li,{children:"Database alias names"}),"\n",(0,i.jsx)(n.li,{children:"Property names"}),"\n",(0,i.jsx)(n.li,{children:"Parameter names"}),"\n",(0,i.jsx)(n.li,{children:"Function names"}),"\n",(0,i.jsx)(n.li,{children:"FTS index names"}),"\n"]}),"\n",(0,i.jsx)(n.h4,{id:"syntax-15",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-34-identifier-syntax",children:"Example 34. Identifier Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"identifier       = ( plainIdentifier | quotedIdentifier )\nplainIdentifier  = /[a-zA-Z_][a-zA-Z0-9_$]*/\nquotedIdentifier = /`[^`]+`/\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"tip",children:[(0,i.jsx)(n.p,{children:"To use other than basic characters in the identifier, surround the identifier\nwith the backticks ` character. For example, to use a hyphen (-) in an\nidentifier, use backticks to surround the identifier."}),(0,i.jsxs)(n.p,{children:["Please note that backticks are commonly used for string literals/interpolation in TypeScript/JavaScript. Therefore, you should be aware that backticks need to be escaped properly to function correctly in TypeScript/JavaScript. For more information, refer to ",(0,i.jsx)(n.a,{href:"https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html",children:"Template Literal Types in TypeScript"}),"."]})]}),"\n",(0,i.jsx)(n.h4,{id:"example-15",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-35-identifier-examples",children:"Example 35. Identifier Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"-- This query uses the default scope and default collection (_default._default) in Couchbase.\nSELECT *\nFROM _default._default;\n\nSELECT *\nFROM test-scope.test-collection;\n\nSELECT key\nFROM testScope.testCollection;\n\nSELECT key$1\nFROM test_Scope.test_Collection;\n\nSELECT `key-1`\nFROM testScope.testCollection;\n"})}),"\n",(0,i.jsx)(n.h3,{id:"property-expression",children:"Property Expression"}),"\n",(0,i.jsx)(n.h4,{id:"purpose-16",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"The property expression is used to reference a property of a dictionary."}),"\n",(0,i.jsx)(n.h4,{id:"syntax-16",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-36-property-expression-syntax",children:"Example 36. Property Expression Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"property     = ( * | dataSourceName . _? * | propertyPath )\npropertyPath = propertyName ( ( . _? propertyName ) | ( [ _? numeric _? ] _? ) )*\npropertyName = IDENTIFIER\n"})}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsx)(n.li,{children:"Prefix the property expression with the data source name or alias to indicate\nits origin."}),"\n",(0,i.jsx)(n.li,{children:"Use dot syntax to refer to nested properties in the propertyPath."}),"\n",(0,i.jsxs)(n.li,{children:["Use bracket (",(0,i.jsx)(n.code,{children:"[index]"}),") syntax to refer to an item in an array."]}),"\n",(0,i.jsxs)(n.li,{children:["Use the asterisk (",(0,i.jsx)(n.code,{children:"*"}),") character to represents all properties. This can only\nbe used in the result list of the ",(0,i.jsx)(n.code,{children:"SELECT"})," clause."]}),"\n"]}),"\n",(0,i.jsx)(n.h4,{id:"example-16",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-37-property-expressions-examples",children:"Example 37. Property Expressions Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT *\nFROM crm.customer\nWHERE contact.firstName = 'daniel';\n\nSELECT crm.customer.*\nFROM crm.customer\nWHERE contact.firstName = 'daniel';\n\nSELECT crm.customer.contact.address.city\nFROM crm.customer\nWHERE contact.firstName = 'daniel';\n\nSELECT contact.address.city, contact.phones[0]\nFROM crm.customer\nWHERE contact.firstName = 'daniel';\n"})}),"\n",(0,i.jsx)(n.h3,{id:"any-and-every-expression",children:"Any and Every Expression"}),"\n",(0,i.jsx)(n.h4,{id:"purpose-17",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Evaluates expressions over items in an array."}),"\n",(0,i.jsx)(n.h4,{id:"syntax-17",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-38-any-and-every-expression-syntax",children:"Example 38. Any and Every Expression Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"arrayExpression = anyEvery _ variableName _ IN _ expression _ SATISFIES _ expression _ END\nanyEvery        = ( anyOrSome AND EVERY | anyOrSome | EVERY )\nanyOrSome       = ( ANY | SOME )\nvariableName    = IDENTIFIER\n"})}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["The array expression starts with ",(0,i.jsx)(n.code,{children:"anyEvery"}),", where each possible combination\nhas a different function as described below, and is terminated by ",(0,i.jsx)(n.code,{children:"END"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"ANY"})," or ",(0,i.jsx)(n.code,{children:"SOME"}),": Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if at least one item in the array satisfies\nthe expression, otherwise returns ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]}),"\n",(0,i.jsx)(n.admonition,{type:"note",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"ANY"})," and ",(0,i.jsx)(n.code,{children:"SOME"})," are interchangeable."]})}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"EVERY"}),": Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if all items in the array satisfies the expression,\notherwise returns ",(0,i.jsx)(n.code,{children:"FALSE"}),". If the array is empty, returns ",(0,i.jsx)(n.code,{children:"TRUE"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"( ANY | SOME ) AND EVERY"}),": Same as ",(0,i.jsx)(n.code,{children:"EVERY"})," but returns ",(0,i.jsx)(n.code,{children:"FALSE"})," if the\narray is empty."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"variableName"})," represents each item in the array."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"IN"})," keyword is used to specify the array to be evaluated."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"SATISFIES"})," keyword is used to specify the expression to evaluate for\neach item in the array."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"END"})," terminates the array expression."]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.h4,{id:"example-17",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-39-any-and-every-expression-examples",children:"Example 39. Any and Every Expression Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT firstName, lastName\nFROM crm.customer\nWHERE\n  ANY contact IN contacts\n    SATISFIES contact.city = 'San Mateo'\n  END;\n"})}),"\n",(0,i.jsx)(n.h3,{id:"parameter-expression",children:"Parameter Expression"}),"\n",(0,i.jsx)(n.h4,{id:"purpose-18",children:"Purpose"}),"\n",(0,i.jsxs)(n.p,{children:["A parameter expression references a value from the ",(0,i.jsx)(n.code,{children:"api|Parameters"})," assigned to\nthe query before execution."]}),"\n",(0,i.jsx)(n.admonition,{type:"note",children:(0,i.jsx)(n.p,{children:"If a parameter is specified in the query string, but no value has been provided,\nan error will be thrown when executing the query."})}),"\n",(0,i.jsx)(n.h4,{id:"syntax-18",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-40-parameter-expression-syntax",children:"Example 40. Parameter Expression Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"parameter = $ IDENTIFIER\n"})}),"\n",(0,i.jsx)(n.h4,{id:"example-18",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-41-parameter-expression-examples",children:"Example 41. Parameter Expression Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT *\nFROM crm.customer\nWHERE contact.firstName = $firstName;\n"})}),"\n",(0,i.jsx)(n.h4,{id:"example-42-using-a-parameter",children:"Example 42. Using a Parameter"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"const query = database.createQuery('SELECT * FROM crm.customer WHERE contact.firstName = $firstName');\nconst params = new Parameters();                    \nparams.setValue('firstName', 'daniel');\nquery.parameters = params;\nconst resultSet = await query.execute();\n"})}),"\n",(0,i.jsx)(n.h3,{id:"parenthesis-expression",children:"Parenthesis Expression"}),"\n",(0,i.jsx)(n.h4,{id:"purpose-19",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Use parentheses to group expressions together to make them more readable or to\nestablish operator precedence."}),"\n",(0,i.jsx)(n.h4,{id:"example-19",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-43-parenthesis-expression-examples",children:"Example 43. Parenthesis Expression Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT (value1 + value2) * value 3\nFROM testScope.testCollection\n\nSELECT *\nFROM testScope.testCollection\nWHERE ((value1 + value2) * value3) + value4 = 10;\n\nSELECT *\nFROM testScope.testCollection\nWHERE (value1 = value2)\n   OR (value3 = value4);\n"})}),"\n",(0,i.jsx)(n.h2,{id:"operators",children:"Operators"}),"\n",(0,i.jsx)(n.h3,{id:"binary-operators",children:"Binary Operators"}),"\n",(0,i.jsx)(n.h4,{id:"maths",children:"Maths"}),"\n",(0,i.jsx)(n.h4,{id:"table-2-maths-operators",children:"Table 2. Maths Operators"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Op"}),(0,i.jsx)(n.th,{children:"Description"}),(0,i.jsx)(n.th,{children:"Example"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"+"})}),(0,i.jsx)(n.td,{children:"Add"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 + v2 = 10"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"-"})}),(0,i.jsx)(n.td,{children:"Subtract"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 - v2 = 10"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"*"})}),(0,i.jsx)(n.td,{children:"Multiply"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 \\* v2 = 10"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"/"})}),(0,i.jsx)(n.td,{children:"Divide - see 1"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 / v2 = 10"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"%"})}),(0,i.jsx)(n.td,{children:"Modulus"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 % v2 = 0"})})]})]})]}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["If both operands are integers, integer division is used, but if one is a\nfloating number, then float division is used. This differs from SQL++ for\nServer, which performs float division regardless. Use ",(0,i.jsx)(n.code,{children:"DIV(x, y)"})," to force\nfloat division in SQL++ for Mobile."]}),"\n"]}),"\n",(0,i.jsx)(n.h4,{id:"comparison-operators",children:"Comparison Operators"}),"\n",(0,i.jsx)(n.h5,{id:"purpose-20",children:"Purpose"}),"\n",(0,i.jsxs)(n.p,{children:["The comparison operators can for example be used in the ",(0,i.jsx)(n.code,{children:"WHERE"})," clause to\nspecify the condition on which to match documents."]}),"\n",(0,i.jsx)(n.h4,{id:"table-3-comparison-operators",children:"Table 3. Comparison Operators"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Op"}),(0,i.jsx)(n.th,{children:"Description"}),(0,i.jsx)(n.th,{children:"Example"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"="})," or ",(0,i.jsx)(n.code,{children:"=="})]}),(0,i.jsx)(n.td,{children:"Equals"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 = v2<br/> WHERE v1 == v2"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"!="})," or &#60&#62"]}),(0,i.jsx)(n.td,{children:"Not Equal to"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 != v2<br/> WHERE v1 &#60&#62 v2"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:">"})}),(0,i.jsx)(n.td,{children:"Greater than"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 > v2"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:">="})}),(0,i.jsx)(n.td,{children:"Greater than or equal to"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 >= v2"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"<"})}),(0,i.jsx)(n.td,{children:"Less than"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 < v2"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"<="})}),(0,i.jsx)(n.td,{children:"Less than or equal to"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 <= v2"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IN"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if the value is in the list or array of values specified by the right hand side expression; Otherwise returns ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE 'James' IN contactsList"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"LIKE"})}),(0,i.jsxs)(n.td,{children:["String wildcard pattern matching, comparison - see 2. Two wildchards are supported: ",(0,i.jsx)("br",{})," \u2022 ",(0,i.jsx)(n.code,{children:"%"})," Matches zero or more characters. ",(0,i.jsx)("br",{})," \u2022 _` Matches a single character."]}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"WHERE name LIKE 'a%'"})," ",(0,i.jsx)("br",{})," ",(0,i.jsx)(n.code,{children:"WHERE name LIKE '%a'"})," ",(0,i.jsx)("br",{})," ",(0,i.jsx)(n.code,{children:"WHERE name LIKE '%or%'"})," ",(0,i.jsx)("br",{})," ",(0,i.jsx)(n.code,{children:"WHERE name LIKE 'a%o%'"})," ",(0,i.jsx)("br",{})," ",(0,i.jsx)(n.code,{children:"WHERE name LIKE '%_r%'"})," ",(0,i.jsx)("br",{})," ",(0,i.jsx)(n.code,{children:"WHERE name LIKE '%a_%'"})," ",(0,i.jsx)("br",{})," ",(0,i.jsx)(n.code,{children:"WHERE name LIKE '%a__%'"})," ",(0,i.jsx)("br",{})," ",(0,i.jsx)(n.code,{children:"WHERE name LIKE 'aldo'"})," ",(0,i.jsx)("br",{})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MATCH"})}),(0,i.jsx)(n.td,{children:"String matching using FTS"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:'WHERE v1-index MATCH "value"'})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"BETWEEN"})}),(0,i.jsxs)(n.td,{children:["Logically equivalent to ",(0,i.jsx)(n.code,{children:"v1 >= start AND v1 <= end"})]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 BETWEEN 10 AND 100"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"IS NULL"})," - see 3"]}),(0,i.jsxs)(n.td,{children:["Equal to ",(0,i.jsx)(n.code,{children:"null"})]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 IS NULL"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IS NOT NULL"})}),(0,i.jsxs)(n.td,{children:["Not equal to ",(0,i.jsx)(n.code,{children:"null"}
1)]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 IS NOT NULL"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IS MISSING"})}),(0,i.jsx)(n.td,{children:"Equal to MISSING"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 IS MISSING"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IS NOT MISSING"})}),(0,i.jsx)(n.td,{children:"Not equal to MISSING"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 IS NOT MISSING"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IS VALUED"})}),(0,i.jsxs)(n.td,{children:["Logically equivalent to ",(0,i.jsx)(n.code,{children:"IS NOT NULL AND MISSING"})]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 IS VALUED"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IS NOT VALUED"})}),(0,i.jsxs)(n.td,{children:["Logically equivalent to ",(0,i.jsx)(n.code,{children:"IS NULL OR MISSING"})]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 IS NOT VALUED"})})]})]})]}),"\n",(0,i.jsxs)(n.ol,{start:"2",children:["\n",(0,i.jsx)(n.li,{children:"Matching is case-insensitive for ASCII characters, case-sensitive for\nnon-ASCII."}),"\n",(0,i.jsxs)(n.li,{children:["Use of ",(0,i.jsx)(n.code,{children:"IS"})," and ",(0,i.jsx)(n.code,{children:"IS NOT"})," is limited to comparing ",(0,i.jsx)(n.code,{children:"NULL"})," and ",(0,i.jsx)(n.code,{children:"MISSING"})," values\n(this encompasses ",(0,i.jsx)(n.code,{children:"VALUED"}),"). This is different from ",(0,i.jsx)(n.code,{children:"api|QueryBuilder"}),", in\nwhich they operate as equivalents of ",(0,i.jsx)(n.code,{children:"=="})," and ",(0,i.jsx)(n.code,{children:"!="}),"."]}),"\n"]}),"\n",(0,i.jsx)(n.h4,{id:"table-4-comparing-null-and-missing-values-using-is",children:"Table 4. Comparing NULL and MISSING values using IS"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Op"}),(0,i.jsxs)(n.th,{children:["Non-",(0,i.jsx)(n.code,{children:"NULL"})," Value"]}),(0,i.jsx)(n.th,{children:(0,i.jsx)(n.code,{children:"NULL"})}),(0,i.jsx)(n.th,{children:(0,i.jsx)(n.code,{children:"MISSING"})})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IS NULL"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IS NOT NULL"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IS MISSING"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IS NOT MISSING"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IS VALUED"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IS NOT VALUED"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})})]})]})]}),"\n",(0,i.jsx)(n.h4,{id:"logical-operators",children:"Logical Operators"}),"\n",(0,i.jsx)(n.h5,{id:"purpose-21",children:"Purpose"}
1),"\n",(0,i.jsx)(n.p,{children:"Logical operators combine expressions using the following boolean logic rules:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"TRUE"})," is ",(0,i.jsx)(n.code,{children:"TRUE"}),", and ",(0,i.jsx)(n.code,{children:"FALSE"})," is ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["Numbers ",(0,i.jsx)(n.code,{children:"0"})," or ",(0,i.jsx)(n.code,{children:"0.0"})," are ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["Arrays and dictionaries are ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["Strings and Blobs are ",(0,i.jsx)(n.code,{children:"TRUE"})," if the values are casted as a non-zero or ",(0,i.jsx)(n.code,{children:"FALSE"}),"\nif the values are casted as ",(0,i.jsx)(n.code,{children:"0"})," or ",(0,i.jsx)(n.code,{children:"0.0"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"NULL"})," is ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"MISSING"})," is ",(0,i.jsx)(n.code,{children:"MISSING"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.admonition,{type:"note",children:[(0,i.jsx)(n.p,{children:"This is different from SQL++ for Server, where:"}),(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"MISSING"}),", ",(0,i.jsx)(n.code,{children:"NULL"})," and ",(0,i.jsx)(n.code,{children:"FALSE"})," are ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["Numbers ",(0,i.jsx)(n.code,{children:"0"})," is ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["Empty strings, arrays, and objects are ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["All other values are ",(0,i.jsx)(n.code,{children:"TRUE"}),"."]}),"\n"]})]}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["Use the ",(0,i.jsx)(n.code,{children:"TOBOOLEAN(expr)"})," function to convert a value based on SQL++ for Server\nboolean value rules."]})}),"\n",(0,i.jsx)(n.h4,{id:"table-5-logical-operators",children:"Table 5. Logical Operators"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Op"}),(0,i.jsx)(n.th,{children:"Description"}),(0,i.jsx)(n.th,{children:"Example"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"AND"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if the operand expressions evaluate to ",(0,i.jsx)(n.code,{children:"TRUE"}),"; otherwise ",(0,i.jsx)(n.code,{children:"FALSE"}),".",(0,i.jsx)("br",{}),(0,i.jsx)("br",{}),"If an operand is ",(0,i.jsx)(n.code,{children:"MISSING"})," and the other is ",(0,i.jsx)(n.code,{children:"TRUE"})," returns ",(0,i.jsx)(n.code,{children:"MISSING"}),", if the other operand is ",(0,i.jsx)(n.code,{children:"FALSE"})," it returns ",(0,i.jsx)(n.code,{children:"FALSE"}),".",(0,i.jsx)("br",{}),(0,i.jsx)("br",{}),"If an operand is ",(0,i.jsx)(n.code,{children:"NULL"})," and the other is ",(0,i.jsx)(n.code,{children:"TRUE"})," returns ",(0,i.jsx)(n.code,{children:"NULL"}),", if the other operand is ",(0,i.jsx)(n.code,{children:"FALSE"})," it returns ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE city = 'San Francisco' AND status = TRUE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"OR"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if one of the operand expressions is evaluated to ",(0,i.jsx)(n.code,{children:"TRUE"}),"; otherwise returns ",(0,i.jsx)(n.code,{children:"FALSE"}),(0,i.jsx)("br",{}),(0,i.jsx)("br",{}),"If an operand is ",(0,i.jsx)(n.code,{children:"MISSING"}),", the operation will result in ",(0,i.jsx)(n.code,{children:"MISSING"})," if the other operand is ",(0,i.jsx)(n.code,{children:"FALSE"})," or ",(0,i.jsx)(n.code,{children:"TRUE"})," if the other operand is ",(0,i.jsx)(n.code,{children:"TRUE"}),".",(0,i.jsx)("br",{}),(0,i.jsx)("br",{}),"If an operand is ",(0,i.jsx)(n.code,{children:"NULL"}),", the operation will result in ",(0,i.jsx)(n.code,{children:"NULL"})," if the other operand is ",(0,i.jsx)(n.code,{children:"FALSE"})," or ",(0,i.jsx)(n.code,{children:"TRUE"})," if the other operand is ",(0,i.jsx)(n.code,{children:"TRUE"}),"."]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE city = 'San Francisco' OR city = 'Santa Clara'"})})]})]})]}),"\n",(0,i.jsx)(n.h4,{id:"table-6-logical-operators-table",children:"Table 6. Logical Operators Table"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:(0,i.jsx)(n.code,{children:"a"})}),(0,i.jsx)(n.th,{children:(0,i.jsx)(n.code,{children:"b"})}),(0,i.jsx)(n.th,{children:(0,i.jsx)(n.code,{children:"a AND b"})}),(0,i.jsx)(n.th,{children:(0,i.jsx)(n.code,{children:"a OR b"})})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"NULL"})}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"FALSE"}),", see 5"]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"NULL"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"FALSE"}),", see 5"]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"NULL"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"FALSE"}),", see 5"]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"FALSE"}),", see 5"]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"NULL"})}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"FALSE"}),", see 5"]}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"FALSE"}),", see 5"]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"FALSE"}),", see 6"]}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"MISSING"}),", see 7"]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"NULL"})}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"FALSE"}),", see 6"]}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"FALSE"}),", see 7"]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})})]})]})]}),"\n",(0,i.jsx)(n.p,{children:"This differs from SQL++ for Server in the following instances:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.ol,{start:"5",children:["\n",(0,i.jsxs)(n.li,{children:["Server will return: ",(0,i.jsx)(n.code,{children:"NULL"})," instead of ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.ol,{start:"6",children:["\n",(0,i.jsxs)(n.li,{children:["Server will return: ",(0,i.jsx)(n.code,{children:"MISSING"})," instead of ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.ol,{start:"7",children:["\n",(0,i.jsxs)(n.li,{children:["Server will return: ",(0,i.jsx)(n.code,{children:"NULL"})," instead of ",(0,i.jsx)(n.code,{children:"MISSING"}),"."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.h4,{id:"string-operators",children:"String Operators"}),"\n",(0,i.jsx)(n.h5,{id:"purpose-22",children:"Purpose"}
1),"\n",(0,i.jsx)(n.p,{children:"A single string operator is provided. It enables string concatenation."}),"\n",(0,i.jsx)(n.h4,{id:"table-7-string-operators",children:"Table 7. String Operators"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Op"}),(0,i.jsx)(n.th,{children:"Description"}),(0,i.jsx)(n.th,{children:"Example"})]})}),(0,i.jsx)(n.tbody,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"&#124&#124"})}),(0,i.jsx)(n.td,{children:"Concatenating"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"SELECT firstName &#124&#124 lastName AS fullName FROM testScope.testCollection"})})]})})]}),"\n",(0,i.jsx)(n.h3,{id:"unary-operators",children:"Unary Operators"}),"\n",(0,i.jsx)(n.h4,{id:"purpose-23",children:"Purpose"}),"\n",(0,i.jsxs)(n.p,{children:["Three unary operators are provided. They operate by modifying an expression,\nmaking it numerically positive or negative, or by logically negating its value\n(",(0,i.jsx)(n.code,{children:"TRUE"})," becomes ",(0,i.jsx)(n.code,{children:"FALSE"}),")."]}),"\n",(0,i.jsx)(n.h4,{id:"syntax-19",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-44-unary-operators-syntax",children:"Example 44. Unary Operators Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"unaryOperator = ( + | - | NOT ) _ expression\n"})}),"\n",(0,i.jsx)(n.h4,{id:"table-8-unary-operators",children:"Table 8. Unary Operators"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Op"}),(0,i.jsx)(n.th,{children:"Description"}),(0,i.jsx)(n.th,{children:"Example"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"+"})}),(0,i.jsx)(n.td,{children:"Positive value"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 = +10"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"-"})}),(0,i.jsx)(n.td,{children:"Negative value"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE v1 = -10"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"NOT"})}),(0,i.jsx)(n.td,{children:"Logical Negate operator, see 8"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:'WHERE "James" NOT IN contactsList'})})]})]})]}),"\n",(0,i.jsxs)(n.ol,{start:"8",children:["\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"NOT"})," operator is often used in conjunction with operators such as ",(0,i.jsx)(n.code,{children:"IN"}),",\n",(0,i.jsx)(n.code,{children:"LIKE"}),", ",(0,i.jsx)(n.code,{children:"MATCH"}),", and ",(0,i.jsx)(n.code,{children:"BETWEEN"})," operators.","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"NOT"})," operation on ",(0,i.jsx)(n.code,{children:"NULL"})," value returns ",(0,i.jsx)(n.code,{children:"NULL"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"NOT"})," operation on ",(0,i.jsx)(n.code,{children:"MISSING"})," value returns ",(0,i.jsx)(n.code,{children:"MISSING"}),"."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.h4,{id:"table-9-not-operators",children:"Table 9. NOT Operators"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:(0,i.jsx)(n.code,{children:"a"})}),(0,i.jsx)(n.th,{children:(0,i.jsx)(n.code,{children:"NOT a"})})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"NULL"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FALSE"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSING"})})]})]})]}),"\n",(0,i.jsxs)(n.h3,{id:"collate-operator",children:[(0,i.jsx)(n.code,{children:"COLLATE"})," Operator"]}),"\n",(0,i.jsx)(n.h4,{id:"purpose-24",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Collate operators specify how a string comparison is conducted."}),"\n",(0,i.jsx)(n.h4,{id:"usage",children:"Usage"}),"\n",(0,i.jsxs)(n.p,{children:["The collate operator is used in conjunction with string comparison expressions\nand ",(0,i.jsx)(n.code,{children:"ORDER BY"})," clauses. It allows for one or more collations. If multiple\ncollations are used, the collations need to be specified in a parenthesis. When\nonly one collation is used, the parenthesis is optional."]}),"\n",(0,i.jsx)(n.admonition,{type:"note",children:(0,i.jsx)(n.p,{children:"Collation is not supported by SQL++ for Server."})}),"\n",(0,i.jsx)(n.h4,{id:"syntax-20",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-45-collate-operator-syntax",children:"Example 45. COLLATE Operator Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"collate   = COLLATE _ ( collation | '(' collation ( _ collation )+ ')' )\ncollation = NO? (UNICODE | CASE | DIACRITICS)\n"})}),"\n",(0,i.jsx)(n.h4,{id:"arguments-7",children:"Arguments"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["The available collation options are:","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"UNICODE"}),": Conduct a Unicode comparison; the default is to do ASCII\ncomparison."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"CASE"}),": Conduct case-sensitive comparison"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"DIACRITIC"}),": Take accents and diacritics into account in the comparison; On\nby default."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"NO"}),": This can be used as a prefix to the other collations, to disable\nthem. For example, use ",(0,i.jsx)(n.code,{children:"NOCASE"}
1)," to enable case-insensitive comparison."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.h4,{id:"example-20",children:"Example"}),"\n",(0,i.jsx)(n.h4,{id:"example-46-collate-operator-example",children:"Example 46. COLLATE Operator Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:'SELECT contact\nFROM crm.customer\nWHERE contact.firstName = "fred" COLLATE UNICODE;\n\nSELECT contact\nFROM crm.customer\nWHERE contact.firstName = "fred" COLLATE (UNICODE CASE);\n\nSELECT firstName, lastName\nFROM crm.customer\nORDER BY firstName COLLATE (UNICODE DIACRITIC), lastName COLLATE (UNICODE DIACRITIC);\n'})}),"\n",(0,i.jsx)(n.h3,{id:"conditional-operator",children:"Conditional Operator"}),"\n",(0,i.jsx)(n.h4,{id:"purpose-25",children:"Purpose"}),"\n",(0,i.jsxs)(n.p,{children:["The conditional (or ",(0,i.jsx)(n.code,{children:"CASE"}),") operator evaluates conditional logic in a similar\nway to the ",(0,i.jsx)(n.code,{children:"IF"}),"/",(0,i.jsx)(n.code,{children:"ELSE"})," operator."]}),"\n",(0,i.jsx)(n.h4,{id:"syntax-21",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-47-conditional-operators-syntax",children:"Example 47. Conditional Operators Syntax"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"case = CASE _ ( expression _ )?\n       ( WHEN _ expression _ THEN _ expression _ )+\n       ( ELSE _ expression _)?\n       END\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Both ",(0,i.jsx)(n.em,{children:"Simple Case"})," and ",(0,i.jsx)(n.em,{children:"Searched Case"})," expressions are supported. The syntactic\ndifference being that the ",(0,i.jsx)(n.em,{children:"Simple Case"})," expression has an expression after the\n",(0,i.jsx)(n.code,{children:"CASE"})," keyword."]}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["Simple Case Expression","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["If the ",(0,i.jsx)(n.code,{children:"CASE"})," expression is equal to the first ",(0,i.jsx)(n.code,{children:"WHEN"})," expression, the\nresult is the ",(0,i.jsx)(n.code,{children:"THEN"})," expression."]}),"\n",(0,i.jsxs)(n.li,{children:["Otherwise, any subsequent ",(0,i.jsx)(n.code,{children:"WHEN"})," clauses are evaluated in the same way."]}),"\n",(0,i.jsxs)(n.li,{children:["If no match is found, the result of the ",(0,i.jsx)(n.code,{children:"CASE"})," expression is the ",(0,i.jsx)(n.code,{children:"ELSE"}),"\nexpression, or ",(0,i.jsx)(n.code,{children:"NULL"})," if no ",(0,i.jsx)(n.code,{children:"ELSE"})," expression was provided."]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["Searched Case Expression","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["If the first ",(0,i.jsx)(n.code,{children:"WHEN"})," expression is ",(0,i.jsx)(n.code,{children:"TRUE"}),", the result of this expression is\nits ",(0,i.jsx)(n.code,{children:"THEN"})," expression."]}),"\n",(0,i.jsxs)(n.li,{children:["Otherwise, subsequent ",(0,i.jsx)(n.code,{children:"WHEN"})," clauses are evaluated in the same way."]}),"\n",(0,i.jsxs)(n.li,{children:["If no ",(0,i.jsx)(n.code,{children:"WHEN"})," clause evaluate to ",(0,i.jsx)(n.code,{children:"TRUE"}),", then the result of the expression\nis the ",(0,i.jsx)(n.code,{children:"ELSE"})," expression, or ",(0,i.jsx)(n.code,{children:"NULL"})," if no ",(0,i.jsx)(n.code,{children:"ELSE"})," expression was provided."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.h4,{id:"examples",children:"Examples"}),"\n",(0,i.jsx)(n.h4,{id:"example-48-simple-case",children:"Example 48. Simple Case"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT\n  CASE state\n    WHEN 'CA'\n      THEN 'Local'\n    ELSE 'Non-Local'\n  END\nFROM testScope.testCollection;\n"})}),"\n",(0,i.jsx)(n.h4,{id:"examples-1",children:"Examples"}),"\n",(0,i.jsx)(n.h4,{id:"example-49-searched-case",children:"Example 49. Searched Case"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-sql",children:"SELECT\n  CASE\n    WHEN shippedOn IS NOT NULL\n      THEN 'SHIPPED'\n    ELSE 'NOT-SHIPPED'\n  END\nFROM testScope.testCollection;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"functions",children:"Functions"}),"\n",(0,i.jsx)(n.h3,{id:"purpose-26",children:"Purpose"}),"\n",(0,i.jsx)(n.p,{children:"Functions provide specialised operations through a generalized syntax."}),"\n",(0,i.jsx)(n.h3,{id:"syntax-22",children:"Syntax"}),"\n",(0,i.jsx)(n.h4,{id:"example-50-functions-syntax",children:"Example 50. Functions Syntax"}),"\n",(0,i.jsx)(n.p,{children:"The function syntax is the same as C-style language function syntax. It starts\nwith the function name, followed by optional arguments inside parentheses."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"function      = functionName _? '(' ( _? expression ( _? ',' _? expression )* _? )? ')'\nfunctionName  = IDENTIFIER\n"})}),"\n",(0,i.jsx)(n.h3,{id:"aggregation-functions",children:"Aggregation Functions"}),"\n",(0,i.jsx)(n.h4,{id:"table-10-aggregation-functions",children:"Table 10. Aggregation Functions"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Function"}),(0,i.jsx)(n.th,{children:"Description"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"AVG(value)"})}),(0,i.jsx)(n.td,{children:"Returns the average of all numeric values in the group."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"COUNT(value)"})}),(0,i.jsx)(n.td,{children:"Returns the count of all values in the group."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MIN(value)"})}),(0,i.jsx)(n.td,{children:"Returns the minimum numeric value in the group."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MAX(value)"})}),(0,i.jsx)(n.td,{children:"Returns the maximum numeric value in the group."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"SUM(value)"})}),(0,i.jsx)(n.td,{children:"Returns the sum of all numeric values in the group."})]})]})]}),"\n",(0,i.jsx)(n.h3,{id:"array-functions",children:"Array Functions"}),"\n",(0,i.jsx)(n.h4,{id:"table-11-array-functions",children:"Table 11. Array Functions"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Function"}),(0,i.jsx)(n.th,{children:"Description"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ARRAY_AGG(value)"})}),(0,i.jsxs)(n.td,{children:["Returns an array of the non-",(0,i.jsx)(n.code,{children:"MISSING"})," group values in the input expression, including ",(0,i.jsx)(n.code,{children:"NULL"})," values."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ARRAY_AVG(value)"})}),(0,i.jsxs)(n.td,{children:["Returns the average of all non-",(0,i.jsx)(n.code,{children:"NULL"})," number values in the array; or ",(0,i.jsx)(n.code,{children:"NULL"})," if there are none."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ARRAY_CONTAINS(value)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if the value exists in the array; otherwise ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ARRAY_COUNT(value)"})}),(0,i.jsxs)(n.td,{children:["Returns the number of non-",(0,i.jsx)(n.code,{children:"NULL"})," values in the array."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ARRAY_IFNULL(value)"})}),(0,i.jsxs)(n.td,{children:["Returns the first non-",(0,i.jsx)(n.code,{children:"NULL"})," value in the array."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ARRAY_MAX(value)"})}),(0,i.jsxs)(n.td,{children:["Returns the largest non-",(0,i.jsx)(n.code,{children:"NULL"}),", non_MISSING value in the array."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ARRAY_MIN(value)"})}),(0,i.jsxs)(n.td,{children:["Returns the smallest non-",(0,i.jsx)(n.code,{children:"NULL"}),", non_MISSING value in the array."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ARRAY_LENGTH(value)"})}),(0,i.jsx)(n.td,{children:"Returns the length of the array."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ARRAY_SUM(value)"})}),(0,i.jsxs)(n.td,{children:["Returns the sum of all non-",(0,i.jsx)(n.code,{children:"NULL"})," numeric value in the array."]})]})]})]}),"\n",(0,i.jsx)(n.h3,{id:"conditional-functions",children:"Conditional Functions"}),"\n",(0,i.jsx)(n.h4,{id:"table-12-conditional-functions",children:"Table 12. Conditional Functions"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Function"}),(0,i.jsx)(n.th,{children:"Description"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IFMISSING(value, ...)"})}),(0,i.jsxs)(n.td,{children:["Returns the first non-",(0,i.jsx)(n.code,{children:"MISSING"})," value, or ",(0,i.jsx)(n.code,{children:"NULL"})," if all values are ",(0,i.jsx)(n.code,{children:"MISSING"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IFMISSINGORNULL(value, ...)"})}),(0,i.jsxs)(n.td,{children:["Returns the first non-",(0,i.jsx)(n.code,{children:"NULL"}
1)," and non-",(0,i.jsx)(n.code,{children:"MISSING"})," value, or ",(0,i.jsx)(n.code,{children:"NULL"})," if all values are ",(0,i.jsx)(n.code,{children:"NULL"})," or ",(0,i.jsx)(n.code,{children:"MISSING"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IFNULL(value, ...)"})}),(0,i.jsxs)(n.td,{children:["Returns the first non-",(0,i.jsx)(n.code,{children:"NULL"}),", or ",(0,i.jsx)(n.code,{children:"NULL"})," if all values are ",(0,i.jsx)(n.code,{children:"NULL"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MISSINGIF(value, other)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"MISSING"})," when ",(0,i.jsx)(n.code,{children:"value = other"}),"; otherwise returns ",(0,i.jsx)(n.code,{children:"value"}),". ",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"MISSING"})," if either or both expressions are ",(0,i.jsx)(n.code,{children:"MISSING"}),".",(0,i.jsx)("br",{})," Returns ",(0,i.jsx)(n.code,{children:"NULL"})," if either or both expressions are ",(0,i.jsx)(n.code,{children:"NULL"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"NULLIF(value, other)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"NULL"})," when ",(0,i.jsx)(n.code,{children:"value = other"}),"; otherwise returns ",(0,i.jsx)(n.code,{children:"value"}),". ",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"MISSING"})," if either or both expressions are ",(0,i.jsx)(n.code,{children:"MISSING"}),".",(0,i.jsx)("br",{})," Returns ",(0,i.jsx)(n.code,{children:"NULL"})," if either or both expressions are ",(0,i.jsx)(n.code,{children:"NULL"}),"."]})]})]})]}),"\n",(0,i.jsx)(n.h3,{id:"date-and-time-functions",children:"Date and Time Functions"}),"\n",(0,i.jsx)(n.h4,{id:"table-13-date-and-time-functions",children:"Table 13. Date and Time Functions"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Function"}),(0,i.jsx)(n.th,{children:"Description"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"STR_TO_MILLIS(value)"})}),(0,i.jsx)(n.td,{children:"Returns the number of milliseconds since the unix epoch of the given ISO 8601 date input string."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"STR_TO_UTC(value)"})}),(0,i.jsx)(n.td,{children:"Returns the ISO 8601 UTC date time string of the given ISO 8601 date input string."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MILLIS_TO_STR(value)"})}),(0,i.jsx)(n.td,{children:"Returns a ISO 8601 date time string in device local timezone of the given number of milliseconds since the unix epoch expression."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"MILLIS_TO_UTC(value)"})}),(0,i.jsx)(n.td,{children:"Returns the UTC ISO 8601 date time string of the given number of milliseconds since the unix epoch expression."})]})]})]}),"\n",(0,i.jsx)(n.h3,{id:"full-text-search-functions",children:"Full Text Search Functions"}),"\n",(0,i.jsx)(n.h4,{id:"table-14-fts-functions",children:"Table 14. FTS Functions"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Function"}),(0,i.jsx)(n.th,{children:"Description"}),(0,i.jsx)(n.th,{children:"Example"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"MATCH(indexName, term"}),")`"]}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if ",(0,i.jsx)(n.code,{children:"term"})," expression matches the FTS indexed document. ",(0,i.jsx)(n.code,{children:"indexName"})," identifies the FTS index to search for matches."]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE MATCH(description, 'couchbase')"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"RANK(indexName)"})}),(0,i.jsx)(n.td,{children:"Returns a numeric value indicating how well the current query result matches the full-text query when performing the MATCH. indexName is an IDENTIFIER for the FTS index."}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"WHERE MATCH(description, 'couchbase') ORDER BY RANK(description)"})})]})]})]}),"\n",(0,i.jsx)(n.h3,{id:"maths-functions",children:"Maths Functions"}),"\n",(0,i.jsx)(n.h4,{id:"table-15-maths-functions",children:"Table 15. Maths Functions"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Function"}),(0,i.jsx)(n.th,{children:"Description"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ABS(value)"})}),(0,i.jsx)(n.td,{children:"Returns the absolute value of a number."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ACOS(value)"})}),(0,i.jsx)(n.td,{children:"Returns the arc cosine in radians."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ASIN(value)"})}),(0,i.jsx)(n.td,{children:"Returns the arcsine in radians."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ATAN(value)"})}),(0,i.jsx)(n.td,{children:"Returns the arctangent in radians."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ATAN2(a, b)"})}),(0,i.jsxs)(n.td,{children:["Returns the arctangent of ",(0,i.jsx)(n.code,{children:"a"})," / ",(0,i.jsx)(n.code,{children:"b"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"CEIL(value)"})}),(0,i.jsx)(n.td,{children:"Returns the smallest integer not less than the number."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"COS(value)"})}),(0,i.jsx)(n.td,{children:"Returns the cosine of an angle in radians."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"DIV(a, b)"})}),(0,i.jsxs)(n.td,{children:["Returns float division of ",(0,i.jsx)(n.code,{children:"a"})," and ",(0,i.jsx)(n.code,{children:"b"}),". Both ",(0,i.jsx)(n.code,{children:"a"})," and ",(0,i.jsx)(n.code,{children:"b"})," are cast to a double number before division. The returned result is always a double."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"DEGREES(value)"})}),(0,i.jsx)(n.td,{children:"Converts radians to degrees."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"E()"})}),(0,i.jsx)(n.td,{children:"Returns the e constant, which is the base of natural logarithms."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"EXP(value)"})}),(0,i.jsx)(n.td,{children:"Returns the natural exponential of a number."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"FLOOR(value)"})}),(0,i.jsx)(n.td,{children:"Returns largest integer not greater than the number."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"IDIV(a, b)"})}),(0,i.jsxs)(n.td,{children:["Returns integer division of ",(0,i.jsx)(n.code,{children:"a"})," and ",(0,i.jsx)(n.code,{children:"b"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"LN(value)"})}),(0,i.jsx)(n.td,{children:"Returns log base e."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"LOG(value)"})}),(0,i.jsx)(n.td,{children:"Returns log base 10."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"PI()"})}),(0,i.jsx)(n.td,{children:"Returns the pi constant."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"POWER(a, b)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"a"})," to the ",(0,i.jsx)(n.code,{children:"b"}),"th power."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"RADIANS(value)"})}),(0,i.jsx)(n.td,{children:"Converts degrees to radians."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ROUND(value (, digits)?)"})}),(0,i.jsxs)(n.td,{children:["Returns the rounded value to the given number of integer digits to the right of the decimal point (left if digits is negative). Digits are 0 if not given.",(0,i.jsx)("br",{}),(0,i.jsx)("br",{})," The function uses Rounding Away From Zero convention to round midpoint values to the next number away from zero (so, for example, ",(0,i.jsx)(n.code,{children:"ROUND(1.75)"})," returns 1.8 but ",(0,i.jsx)(n.code,{children:"ROUND(1.85)"})," returns 1.9."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ROUND_EVEN(value (, digits)?)"})}),(0,i.jsxs)(n.td,{children:["Returns rounded value to the given number of integer digits to the right of the decimal point (left if digits is negative). Digits are 0 if not given.",(0,i.jsx)("br",{}),(0,i.jsx)("br",{})," The function uses Rounding to Nearest Even (Banker's Rounding) convention which rounds midpoint values to the nearest even number (for example, both ",(0,i.jsx)(n.code,{children:"ROUND_EVEN(1.75)"})," and ",(0,i.jsx)(n.code,{children:"ROUND_EVEN(1.85)"})," return 1.8)."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"SIGN(value)"})}),(0,i.jsx)(n.td,{children:"Returns -1 for negative, 0 for zero, and 1 for positive numbers."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"SIN(value)"})}),(0,i.jsx)(n.td,{children:"Returns sine of an angle in radians."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"SQRT(value)"})}),(0,i.jsx)(n.td,{children:"Returns the square root."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TAN(value)"})}),(0,i.jsx)(n.td,{children:"Returns tangent of an angle in radians."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRUNC(value (, digits)?)"})}),(0,i.jsxs)(n.td,{children:["Returns a truncated number to the given number of integer ",(0,i.jsx)(n.code,{children:"digits"})," to the right of the decimal point (left if digits is negative). Digits are 0 if not given."]})]})]})]}),"\n",(0,i.jsx)(n.admonition,{type:"note",children:(0,i.jsxs)(n.p,{children:["The behavior of the ",(0,i.jsx)(n.code,{children:"ROUND()"})," function is different from SQL++ for Server\n",(0,i.jsx)(n.code,{children:"ROUND()"}),", which rounds the midpoint values using Rounding to Nearest Even\nconvention."]})}),"\n",(0,i.jsx)(n.h3,{id:"pattern-searching-functions",children:"Pattern Searching Functions"}),"\n",(0,i.jsx)(n.h4,{id:"table-16-pattern-searching-functions",children:"Table 16. Pattern Searching Functions"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Function"}),(0,i.jsx)(n.th,{children:"Description"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"REGEXP_CONTAINS(value, pattern)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if the string value contains any sequence that matches the regular expression pattern."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"REGEXP_LIKE(value, pattern)"})}),(0,i.jsxs)(n.td,{children:["Return ",(0,i.jsx)(n.code,{children:"TRUE"})," if the string value exactly matches the regular expression pattern."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"REGEXP_POSITION(value, pattern)"})}),(0,i.jsxs)(n.td,{children:["Returns the first position of the occurrence of the regular expression pattern within the input string expression. Returns ",(0,i.jsx)(n.code,{children:"-1"})," if no match is found. Position counting starts from zero."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"REGEXP_REPLACE(value, pattern, repl [, n])"})}),(0,i.jsxs)(n.td,{children:["Returns a new string with occurrences of ",(0,i.jsx)(n.code,{children:"pattern"})," replaced with ",(0,i.jsx)(n.code,{children:"repl"}),". If ",(0,i.jsx)(n.code,{children:"n"})," is given, at the most ",(0,i.jsx)(n.code,{children:"n"})," replacements are performed. If ",(0,i.jsx)(n.code,{children:"n"})," is not given, all matching occurrences are replaced."]})]})]})]}),"\n",(0,i.jsx)(n.h3,{id:"string-functions",children:"String Functions"}),"\n",(0,i.jsx)(n.h4,{id:"table-17-string-functions",children:"Table 17. String Functions"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Function"}),(0,i.jsx)(n.th,{children:"Description"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"CONTAINS(value, substring)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if the substring exists within the input string, otherwise returns ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"LENGTH(value)"})}),(0,i.jsx)(n.td,{children:"Returns the length of a string. The length is defined as the number of characters within the string."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"LOWER(value)"})}),(0,i.jsx)(n.td,{children:"Returns the lower-case string of the input string."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"LTRIM(value)"})}),(0,i.jsx)(n.td,{children:"Returns the string with all leading whitespace characters removed."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"RTRIM(value)"})}),(0,i.jsx)(n.td,{children:"Returns the string with all trailing whitespace characters removed."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TRIM(value)"})}),(0,i.jsx)(n.td,{children:"Returns the string with all leading and trailing whitespace characters removed."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"UPPER(value)"})}),(0,i.jsx)(n.td,{children:"Returns the upper-case string of the input string."})]})]})]}),"\n",(0,i.jsx)(n.h3,{id:"type-checking-functions",children:"Type Checking Functions"}),"\n",(0,i.jsx)(n.h4,{id:"table-18-type-checking-functions",children:"Table 18. Type Checking Functions"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Function"}),(0,i.jsx)(n.th,{children:"Description"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ISARRAY(value)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if ",(0,i.jsx)(n.code,{children:"value"})," is an array, otherwise returns ",(0,i.jsx)(n.code,{children:"MISSING"}),", ",(0,i.jsx)(n.code,{children:"NULL"})," or ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ISATOM(value)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if ",(0,i.jsx)(n.code,{children:"value"})," is a boolean, number, or string, otherwise returns ",(0,i.jsx)(n.code,{children:"MISSING"}),", ",(0,i.jsx)(n.code,{children:"NULL"})," or ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ISBOOLEAN(value)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if ",(0,i.jsx)(n.code,{children:"value"})," is a boolean, otherwise returns ",(0,i.jsx)(n.code,{children:"MISSING"}),", ",(0,i.jsx)(n.code,{children:"NULL"})," or ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ISNUMBER(value)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if ",(0,i.jsx)(n.code,{children:"value"}
1)," is a number, otherwise returns ",(0,i.jsx)(n.code,{children:"MISSING"}),", ",(0,i.jsx)(n.code,{children:"NULL"})," or ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ISOBJECT(value)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if ",(0,i.jsx)(n.code,{children:"value"})," is an object (dictionary), otherwise returns ",(0,i.jsx)(n.code,{children:"MISSING"}),", ",(0,i.jsx)(n.code,{children:"NULL"})," or ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"ISSTRING(value)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"TRUE"})," if ",(0,i.jsx)(n.code,{children:"value"})," is a string, otherwise returns ",(0,i.jsx)(n.code,{children:"MISSING"}),", ",(0,i.jsx)(n.code,{children:"NULL"})," or ",(0,i.jsx)(n.code,{children:"FALSE"}),"."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TYPE(value)"})}),(0,i.jsxs)(n.td,{children:["Returns one of the following strings, based on the value of ",(0,i.jsx)(n.code,{children:"value"}),":",(0,i.jsx)("br",{}),'\u2022 "missing"',(0,i.jsx)("br",{}),'\u2022 "null"',(0,i.jsx)("br",{}),'\u2022 "boolean"',(0,i.jsx)("br",{}),'\u2022 "number"',(0,i.jsx)("br",{}),'\u2022 "string"',(0,i.jsx)("br",{}),'\u2022 "array"',(0,i.jsx)("br",{}),'\u2022 "object"',(0,i.jsx)("br",{}),'\u2022 "binary"']})]})]})]}),"\n",(0,i.jsx)(n.h3,{id:"type-conversion-functionsunctions",children:"Type Conversion Functionsunctions"}),"\n",(0,i.jsx)(n.h4,{id:"table-19-type-conversion-functions",children:"Table 19. Type Conversion Functions"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Function"}),(0,i.jsx)(n.th,{children:"Description"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TOARRAY(value)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"MISSING"})," if the value is ",(0,i.jsx)(n.code,{children:"MISSING"}),".",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"NULL"})," if the value is ",(0,i.jsx)(n.code,{children:"NULL"}),".",(0,i.jsx)("br",{}),"Returns an array value as is.",(0,i.jsx)("br",{}),"Returns all other values wrapped in an array."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TOATOM(value)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"MISSING"})," if the value is ",(0,i.jsx)(n.code,{children:"MISSING"}),".",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"NULL"})," if the value is ",(0,i.jsx)(n.code,{children:"NULL"}),".",(0,i.jsx)("br",{}),"Returns an array of a single item if the value is an array.",(0,i.jsx)("br",{}),"Returns an object of a single key/value pair if the value is an object.",(0,i.jsx)("br",{}),"Returns a boolean, number, or string value as is.",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"NULL"})," for all other values."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TOBOOLEAN(value)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"MISSING"})," if the value is ",(0,i.jsx)(n.code,{children:"MISSING"}),".",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"NULL"})," if the value is ",(0,i.jsx)(n.code,{children:"NULL"}),".",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"FALSE"})," if the value is ",(0,i.jsx)(n.code,{children:"FALSE"}),".",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"FALSE"})," if the value is ",(0,i.jsx)(n.code,{children:"0"})," or ",(0,i.jsx)(n.code,{children:"NaN"}),".",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"FALSE"})," if the value is an empty string, array, and object.",(0,i.jsx)("br",{}),"Return ",(0,i.jsx)(n.code,{children:"TRUE"})," for all other values."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TONUMBER(value)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"MISSING"})," if the value is ",(0,i.jsx)(n.code,{children:"MISSING"}),".",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"NULL"})," if the value is ",(0,i.jsx)(n.code,{children:"NULL"}),".",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"0"})," if the value is ",(0,i.jsx)(n.code,{children:"FALSE"}),".",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"1"})," if the value is ",(0,i.jsx)(n.code,{children:"TRUE"}),".",(0,i.jsx)("br",{}),"Returns a number value as is.",(0,i.jsx)("br",{}),"Parses a string value in to a number.",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"NULL"})," for all other values."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TOOBJECT(value)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"MISSING"})," if the value is ",(0,i.jsx)(n.code,{children:"MISSING"}),".",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"NULL"})," if the value is ",(0,i.jsx)(n.code,{children:"NULL"}),".",(0,i.jsx)("br",{}),"Returns an object value as is.",(0,i.jsx)("br",{}),"Returns an empty object for all other values."]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"TOSTRING(value)"})}),(0,i.jsxs)(n.td,{children:["Returns ",(0,i.jsx)(n.code,{children:"MISSING"})," if the value is ",(0,i.jsx)(n.code,{children:"MISSING"}),".",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"NULL"})," if the value is ",(0,i.jsx)(n.code,{children:"NULL"}),".",(0,i.jsx)("br",{}),'Returns "false" if the value is ',(0,i.jsx)(n.code,{children:"FALSE"}),".",(0,i.jsx)("br",{}),'Returns "true" if the value is ',(0,i.jsx)(n.code,{children:"TRUE"}),".",(0,i.jsx)("br",{}),"Returns a string representation of a number value.",(0,i.jsx)("br",{}),"Returns a string value as is.",(0,i.jsx)("br",{}),"Returns ",(0,i.jsx)(n.code,{children:"NULL"})," for all other values."]})]})]})]}
1),"\n",(0,i.jsx)(n.h2,{id:"querybuilder-differences",children:"QueryBuilder Differences"}),"\n",(0,i.jsxs)(n.p,{children:["SQL++ for Mobile queries support all ",(0,i.jsx)(n.code,{children:"QueryBuilder"})," features. See ",(0,i.jsx)(n.a,{href:"#",children:"Table 20"}),"\nfor the features supported by SQL++ for Mobile but not by ",(0,i.jsx)(n.code,{children:"QueryBuilder"}),"."]}),"\n",(0,i.jsx)(n.h4,{id:"table-20-querybuilder-differences",children:"Table 20. QueryBuilder Differences"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Category"}),(0,i.jsx)(n.th,{children:"Components"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"Conditional Operator"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"CASE(WHEN ... THEN ... ELSE ...)"})})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"Array Functions"}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"ARRAY_AGG"}),", ",(0,i.jsx)(n.code,{children:"ARRAY_AVG"}),", ",(0,i.jsx)(n.code,{children:"ARRAY_COUNT"}),", ",(0,i.jsx)(n.code,{children:"ARRAY_IFNULL"}),", ",(0,i.jsx)(n.code,{children:"ARRAY_MAX"}),", ",(0,i.jsx)(n.code,{children:"ARRAY_MIN"}),", ",(0,i.jsx)(n.code,{children:"ARRAY_SUM"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"Conditional Functions"}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"IFMISSING"}),", ",(0,i.jsx)(n.code,{children:"IFMISSINGORNULL"}),", ",(0,i.jsx)(n.code,{children:"IFNULL"}),", ",(0,i.jsx)(n.code,{children:"MISSINGIF"}),", ",(0,i.jsx)(n.code,{children:"NULLIF"}),", ",(0,i.jsx)(n.code,{children:"MATCH"}),", ",(0,i.jsx)(n.code,{children:"RANK"}),", ",(0,i.jsx)(n.code,{children:"DIV"}),", ",(0,i.jsx)(n.code,{children:"IDIV"}),", ",(0,i.jsx)(n.code,{children:"ROUND_EVEN"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"Pattern Matching Functions"}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"REGEXP_CONTAINS"}),", ",(0,i.jsx)(n.code,{children:"REGEXP_LIKE"}),", ",(0,i.jsx)(n.code,{children:"REGEXP_POSITION"}),", ",(0,i.jsx)(n.code,{children:"REGEXP_REPLACE"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"Type Checking Functions"}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"ISARRAY"}),", ",(0,i.jsx)(n.code,{children:"ISATOM"}),", ",(0,i.jsx)(n.code,{children:"ISBOOLEAN"}),", ",(0,i.jsx)(n.code,{children:"ISNUMBER"}),", ",(0,i.jsx)(n.code,{children:"ISOBJECT"}),", ",(0,i.jsx)(n.code,{children:"ISSTRING"}),", ",(0,i.jsx)(n.code,{children:"TYPE"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"Type Conversion Functions"}),(0,i.jsxs)(n.td,{children:[(0,i.jsx)(n.code,{children:"TOARRAY"}),", ",(0,i.jsx)(n.code,{children:"TOATOM"}),", ",(0,i.jsx)(n.code,{children:"TOBOOLEAN"}),", ",(0,i.jsx)(n.code,{children:"TONUMBER"}),", ",(0,i.jsx)(n.code,{children:"TOOBJECT"}),", ",(0,i.jsx)(n.code,{children:"TOSTRING"})]})]})]})]}),"\n",(0,i.jsx)(n.h2,{id:"query-parameters",children:"Query Parameters"}),"\n",(0,i.jsxs)(n.p,{children:["You can provide runtime parameters to your SQL++ query to make it more flexible.\nTo specify substitutable parameters within your query string prefix the name\nwith ",(0,i.jsx)(n.code,{children:"$"})," - see: ",(0,i.jsx)(n.a,{href:"#example-51-running-a-sql-query",children:"Example 51"}),"."]}),"\n",(0,i.jsx)(n.h4,{id:"example-51-running-a-sql-query",children:"Example 51. Running a SQL++ Query"}),"\n",(0,i.jsxs)(n.p,{children:["You can provide runtime parameters to your SQL++ query to make it more flexible. To specify substitutable parameters within your query string prefix the name with $ - see: ",(0,i.jsx)(n.a,{href:"#example-51-running-a-sql-query",children:"Example 51"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"const query = await database.createQuery(\n  'SELECT META().id AS docId FROM hotel WHERE country = $country'\n);\n\nconst params = new Parameters();\nparams.setString('country','France')\nquery.parameters = params;\nconst resultSet = await query.execute();\n"})}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["Define a parameter placeholder ",(0,i.jsx)(n.code,{children:"$country"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["Set the value of the ",(0,i.jsx)(n.code,{children:"country"})," parameter."]}),"\n"]})]})}function o(e={}){const{wrapper:n}={...(0,l.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(h,{...e})}):h(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>d,x:()=>c});var r=s(6540);const i={},l=r.createContext(i);function d(e){const n=r.useContext(l);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:d(e.components),r.createElement(l.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.