DocumentDB SQL Select Clause - DocumentDB SQL

What is Select Clause in DocumentDB SQL?

The SQL query can be run against our DocumentDB database in Azure portal that has a Query Explorer.
The Query Explorer is used to demonstrate the many different capabilities and features of the query language starting with the simplest possible query.

Step 1 : Azure Portal is opened, and in the database blade, click the Query Explorer blade.

Query explorer balde

As the queries are run within the scope of a collection, the Query Explorer lets us choose the collection in this dropdown. The set to Families collection that contains the three documents. These three documents are shown in this example.

The below code is an AndersenFamily document.

The below code is the SmithFamily document.


The below code is the WakefieldFamily document.

The query SELECT * FROM c is used to open the Query Explorer. That retrieves all documents from the collection. But it's still quite different than the equivalent query in a relational database.

Step 2 :

  • SELECT * means return all columns while in DocumentDB in relational databases. It means that you want each document in your result to be returned exactly as it's stored in the database.
  • When you select specific properties and expressions instead of simply issuing a SELECT *, then you are projecting a new shape that you want for each document in the result.

Step 3 : Click ‘Run’ to execute query and open the Results blade.

open results blade

From the above figure you can see that, the WakefieldFamily, the SmithFamily, and the AndersonFamily are retrieved.

The three documents which are retrieved as a result of the SELECT * FROM c query is shown below.


In the above result the system-generated properties are included which are prefixed with the underscore character.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

DocumentDB SQL Topics