Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[This document supports a preliminary release of a software product that may be changed substantially prior to final commercial release. This document is provided for informational purposes only.]
This topic provides simplified version of the query grammar, with examples embedded. For more information on query support, see Querying SQL Data Services.
expression:
query-expression
| or-expression
![]() |
|---|
| Note expressions which do not return a list of entities are allowed by grammar at top-level. However the type checker will error on them because they do not return a list of entities. |
query-expression:
from identifier in entities-expression
[query-clause [query-clause ...]]
[orderby ordering-property [, ordering-property ...]]
select identifier
from e in entities
where e.Id == "SomeId"
select e
from e in entities
orderby e.Id, e["flexProp"] descending
select e
// Retrieve entities with a flexible property value < 5. Order the result by Kind.
from e in entities
where e["flexProp"] < 5
orderby e.Kind ascending
select e
// Cartesian product of entities, c and entities, o and return entities c
from c in entities
from o in entities
select c
// join Customer and Order entities and return Orders
from c in entities
where c.Kind == "Customer"
from o in entities
where o.Kind == "Order"
where c.Id == o["CustomerId"]
select o
query-clause:
from identifier in entities-expression
| where boolean-expression
entities-expression:
entities
| entities.OfKind(string-constant)
ordering-property:
property [ascending | descending]
or-expression:
and-expression
| boolean-expression || boolean-expression
e.Id == "someId1" || e.Id == "someId2"
and-expression:
equality-expression
| boolean-expression && boolean-expression
e["someFlexProp"] > 5 && e["someFlexProp"] < 10
equality-expression:
relational-expression
| expression == expression
| expression != expression
e["someFlexProp"] > 5 && e["someFlexProp"] < 10
relational-expression:
not-expression
| expression < expression
| expression > expression
| expression <= expression
| expression >= expression
not-expression:
primary-expression
| ! boolean-expression
primary-expression:
( expression )
| property
| constant-value
| base-expression
| base-expression ( [expression [, expression ...]] )
(from e in entities select e).Take(25)
Take(from e in entities select e, 25)
property:
identifier . metadata-property-name
| identifier [ "flexible-property-name" ]
e.Id
e["flexibleProperty"]
constant-value:
string-constant
| numeric-constant
| true | false
| DateTime( date-string )
| Binary( hex-string )
base-expression:
identifier
| primary-expression . identifier
(from e in entities select e).Take(3)
.gif)