Skip to Content
Hands-On Azure for Developers
book

Hands-On Azure for Developers

by Kamil Mrzygłód
November 2018
Intermediate to advanced
606 pages
15h 7m
English
Packt Publishing
Content preview from Hands-On Azure for Developers

SQL

If you think about SQL, you probably see a relational database with tables, relations, and stored procedures. When working with SQL API in Cosmos DB, in fact you will work with documents that can be queried using the SQL syntax. Let us assume you want to query documents using the following call:

SELECT * FROM dbo.Order O WHERE O.AccountNumber = "0000-12-223-12"

Here you can find an example of a query written in C#:

var order =   client.CreateDocumentQuery<Order>(collectionLink)    .Where(so => so.AccountNumber == "0000-12-223-12")    .AsEnumerable()    .FirstOrDefault();

As you can see, it is all about a simple LINQ query, which allows you to use a specific property to filter data. Because all records in Cosmos DB are stored as JSON documents, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Implementing Azure: Putting Modern DevOps to Use

Implementing Azure: Putting Modern DevOps to Use

Florian Klaffenbach, Oliver Michalski, Markus Klein, Mohamed Wali

Publisher Resources

ISBN: 9781789340624Supplemental Content