Expressions in SQL
Expressions are composed of various operators and operands that evaluate to a single value or a set of values. Some expressions do not use operators; for example, a column name is an expression. Expressions are used in many contexts, such as specifying values to be retrieved (in a SELECT clause) or compared (in a WHERE clause).
In the following example, empname and empage are expressions representing the column values to be retrieved, salary is an expression representing a column value to be compared, and 75000 is an integer literal expression.
SELECT empname, empage FROM employee
WHERE salary > 75000
Expressions that contain aggregate functions can appear only in SELECT lists and HAVING clauses unless they are within a nested SELECT clause. Aggregate functions cannot be nested.
An expression can be enclosed in parentheses without affecting its value.
Last modified date: 08/29/2024