|
1 | 1 | ---
|
2 |
| -title: 'Tutorial: How to query with SQL in Azure Cosmos DB?' |
3 |
| -description: In this tutorial, learn how to query with SQL queries in Azure Cosmos DB using the query playground. |
| 2 | +title: | |
| 3 | + Tutorial: Query data |
| 4 | +titleSuffix: Azure Cosmos DB for NoSQL |
| 5 | +description: In this tutorial, learn how to query data in Azure Cosmos DB for NoSQL with the built-in query syntax using the Data Explorer. |
4 | 6 | author: seesharprun
|
5 | 7 | ms.author: sidandrews
|
6 | 8 | ms.reviewer: mjbrown
|
7 | 9 | ms.service: cosmos-db
|
8 | 10 | ms.subservice: nosql
|
9 | 11 | ms.custom: tutorial-develop, mvc, ignite-2022
|
10 | 12 | ms.topic: tutorial
|
11 |
| -ms.date: 03/07/2023 |
| 13 | +ms.date: 03/16/2023 |
12 | 14 | ---
|
13 | 15 |
|
14 |
| -# Tutorial: Query Azure Cosmos DB by using the API for NoSQL |
| 16 | +# Tutorial: Query data in Azure Cosmos DB for NoSQL |
| 17 | + |
15 | 18 | [!INCLUDE[NoSQL](../includes/appliesto-nosql.md)]
|
16 | 19 |
|
17 |
| -The Azure Cosmos DB [API for NoSQL](../introduction.md) supports querying documents using SQL. This article provides a sample document and two sample SQL queries and results. |
| 20 | +[Azure Cosmos DB for NoSQL](../introduction.md) supports querying documents using the built-in query syntax. This article provides a sample document and two sample queries and results. |
18 | 21 |
|
19 | 22 | This article covers the following tasks:
|
20 | 23 |
|
21 | 24 | > [!div class="checklist"]
|
22 |
| -> - Query data with SQL |
| 25 | +> |
| 26 | +> - Query NoSQL data with the built-in query syntax |
| 27 | +> |
23 | 28 |
|
24 | 29 | ## Prerequisites
|
25 | 30 |
|
26 |
| -This tutorial assumes you have an Azure Cosmos DB account and collection. Don't have any of those resources? Complete this quickstart: [Create an Azure Cosmos DB account, database, container, and items from the Azure portal](quickstart-portal.md). |
| 31 | +This tutorial assumes you have an Azure Cosmos DB account, database, and container. |
| 32 | + |
| 33 | +Don't have any of those resources? Complete this quickstart: [Create an Azure Cosmos DB account, database, container, and items from the Azure portal](quickstart-portal.md). |
| 34 | + |
| 35 | +You can run the queries using the [Azure Cosmos DB Explorer](../data-explorer.md) in the Azure portal. You can also run queries by using the [REST API](/rest/api/cosmos-db/) or [various SDKs](sdk-dotnet-v3.md). |
| 36 | + |
| 37 | +For more information about queries, see [setting started with queries](query/getting-started.md). |
27 | 38 |
|
28 | 39 | ## Sample document
|
29 | 40 |
|
30 |
| -The SQL queries in this article use the following sample document. |
| 41 | +The queries in this article use the following sample document. |
31 | 42 |
|
32 | 43 | ```json
|
33 | 44 | {
|
@@ -58,15 +69,9 @@ The SQL queries in this article use the following sample document.
|
58 | 69 | }
|
59 | 70 | ```
|
60 | 71 |
|
61 |
| -## Where can I run SQL queries? |
62 |
| - |
63 |
| -You can run queries using the Data Explorer in the Azure portal and by using the [REST API and SDKs](sdk-dotnet-v2.md). |
64 |
| - |
65 |
| -For more information about SQL queries, see [Getting started with queries](query/getting-started.md). |
66 |
| - |
67 |
| -## Example query 1 |
| 72 | +## Select all fields and apply a filter |
68 | 73 |
|
69 |
| -Given the sample family document, following SQL query returns the documents where the ID field matches `WakefieldFamily`. Since it's a `SELECT *` statement, the output of the query is the complete JSON document: |
| 74 | +Given the sample family document, the following query returns the documents where the ID field matches `WakefieldFamily`. Since it's a `SELECT *` statement, the output of the query is the complete JSON document: |
70 | 75 |
|
71 | 76 | Query:
|
72 | 77 |
|
@@ -107,7 +112,7 @@ Results:
|
107 | 112 | }
|
108 | 113 | ```
|
109 | 114 |
|
110 |
| -## Example query 2 |
| 115 | +## Select a cross-product of a child collection field |
111 | 116 |
|
112 | 117 | The next query returns all the given names of children in the family whose ID matches `WakefieldFamily`.
|
113 | 118 |
|
@@ -138,7 +143,9 @@ Results:
|
138 | 143 | In this tutorial, you've done the following tasks:
|
139 | 144 |
|
140 | 145 | > [!div class="checklist"]
|
141 |
| -> - Learned how to query using SQL |
| 146 | +> |
| 147 | +> - Learned how to query using the built-in query syntax |
| 148 | +> |
142 | 149 |
|
143 | 150 | You can now proceed to the next tutorial to learn how to distribute your data globally.
|
144 | 151 |
|
|
0 commit comments