Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Azure DocumentDB

You're reading from   Learning Azure DocumentDB Create outstanding enterprise solutions around DocumentDB using the latest technologies and programming tools with Azure

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher
ISBN-13 9781783552467
Length 152 pages
Edition 1st Edition
Concepts
Arrow right icon
Author (1):
Arrow left icon
Riccardo Becker Riccardo Becker
Author Profile Icon Riccardo Becker
Riccardo Becker
Arrow right icon
View More author details
Toc

Using the FROM clause


The FROM clause is an optional clause, unless you want to apply filtering (by using the WHERE clause). The WHERE clause is used to specify the source(s) upon which the query needs to be executed. Mostly, the WHERE clause is used to select a collection. The FROM clause is needed when you want to query a collection.

Another example of using the SELECT statement without the FROM clause is the following code snippet:

SELECT CONTAINS(UPPER("Riccardo"), UPPER("ri"))

This SELECT statement only operates on string values and uses some of the built-in functions that DocumentDB provides (CONTAINS and UPPER). The output of this SELECT statement is as follows:

[
  {
    "$1": true
  }
]

Potentially, you could use DocumentDB only for its built-in functions, but it would be an expensive solution.

Aliasing

Collections can be aliased by applying the AS operator:

SELECT p.FirstName, p.LastName FROM PersonInformation AS p

Once we decide to use aliasing, we can no longeruse PersonInformation as...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image