2.10.2.1.1. JPQL Select Statement
A select statement is a string which consists of the following clauses:
-
a
SELECTclause, which determines the type of the objects or values to be selected. -
a
FROMclause, which provides declarations that designate the domain to which the expressions specified in the other clauses of the query apply. -
an optional
WHEREclause, which may be used to restrict the results that are returned by the query. -
an optional
GROUP BYclause, which allows query results to be aggregated in terms of groups. -
an optional
HAVINGclause, which allows filtering over aggregated groups. -
an optional
ORDER BYclause, which may be used to order the results that are returned by the query.
In BNF syntax, a select statement is defined as:
-
select_statement ::= select_clause from_clause [where_clause] [groupby_clause] [having_clause] [orderby_clause]
A select statement must always have a SELECT and a FROM clause.
The square brackets [] indicate that the other clauses are optional.