Simplified Syntax
This section briefly describes the syntax of the query language so that you can quickly move on to the next section, Example Queries. When you are ready to learn about the syntax in more detail, see the section Full Syntax.
Select Statements
A select query has six clauses:
SELECT,FROM,WHERE,GROUP BY,HAVING, andORDER BY. TheSELECTandFROMclauses are required, but theWHERE,GROUP BY,HAVING, andORDER BYclauses are optional. Here is the high-level BNF syntax of a query language query:QL_statement ::= select_clause from_clause [where_clause][groupby_clause][having_clause][orderby_clause]The
SELECTclause defines the types of the objects or values returned by the query.The
FROMclause defines the scope of the query by declaring one or more identification variables, which can be referenced in theSELECTandWHEREclauses. An identification variable represents one of the following elements:The
WHEREclause is a conditional expression that restricts the objects or values retrieved by the query. Although it is optional, most queries have aWHEREclause.The
GROUP BYclause groups query results according to a set of properties.The
HAVINGclause is used with theGROUP BYclause to further restrict the query results according to a conditional expression.The
ORDER BYclause sorts the objects or values returned by the query into a specified order.Update and Delete Statements
Update and delete statements provide bulk operations over sets of entities. They have the following syntax:
update_statement :: = update_clause [where_clause] delete_statement :: = delete_clause [where_clause]The update and delete clauses determine the type of the entities to be updated or deleted. The
WHEREclause may be used to restrict the scope of the update or delete operation.