Azure Cosmos DB With SQL Query Cheat Sheet PDF

Microsoft Azure Cosmos DB supports querying documents using SQL (Structured Query Language) as a JSON query language. Cosmos DB is truly schema-free. By its commitment to the JSON data model directly within the database engine, it provides automatic indexing of JSON documents without requiring explicit schema or creation of secondary indexes.

Azure DocumentDB supports query JSON documents using familiar and friendly SQL syntax. If you know SQL, you can get up and running quickly with Azure DocumentDB. It also helps in quick writing the queries for DocumentDB API data by displaying common database queries, keywords, built-in functions, and operators in an easy to print PDF reference sheet.

Cosmos DB supports relational, hierarchical, and spatial querying of JSON documents using SQL without specifying a schema or secondary indexes, JavaScript user defined functions (UDFs), JavaScript operators, and a multitude of built-in functions.

Download the Cosmos DB SQL query cheat sheet PDF

This cheat sheet helps write DocumentDB queries quickly by showing some common SQL queries used to retrieve data from two simple JSON documents. For a relational database example, there are two key differences when writing queries on Azure DocumentDB.

  1. We can query without specifying explicit schema or creating secondary indexes. This is possible due to DocumentDB's deep commitment to the JSON data model. Since JSON always contains metadata in the form of property names in addition to values, DocumentDB can determine the schema and index data as documents are inserted, and lets you query against that index.

  2. The SQL type system, expression evaluation, function invocation (UDFs), and other aspects of DocumentDB mirror that of JavaScript. DocumentDB is a JSON document database capable of executing JavaScript directly in the database engine, using JavaScript's programming model as the foundation for the query language.

    Azure Cosmos DB

The above SQL cheat sheet PDF shows common queries used to retrieve data from two example JSON documents. In case you are looking to run and test SQL, you can use Online Demo. You can also review SQL queries for Azure Cosmos DB DocumentDB API at MS Document.

Up Next
    Ebook Download
    View all
    Learn
    View all