UltraLite Database User's Guide
Dynamic SQL
Dynamic SQL language elements
Expressions in UltraLite dynamic SQL are built from column names, constants, and operators. Expressions evaluate to a value, and so have data types associated with them.
expression :
constant
| column-name
| - expression
| expression operator expression
| ( expression )
| function-name ( expression, ... )
An aggregate expression calculates a single value from a range of rows. For example, the following query computes the total payroll for employees in the employee table. In this query, SUM( salary )
is an aggregate expression:
SELECT sum( salary ) FROM employee
An aggregate expression is one in which either an aggregate function is used, or in which one or more of the operands is an aggregate expression.
When a SELECT statement does not have a GROUP BY clause, the expressions in the select-list must be either all aggregate expressions or none of the expressions can be an aggregate expression. When a SELECT statement does have a GROUP BY clause, any non-aggregate expression in the select-list must appear in the GROUP BY list.