Expressions in Queries
You can use an expression anywhere in a query where you can use a column name. Expressions can calculate values to display, be part of search conditions, or combine the contents of data columns. An expression can consist of a mathematical calculation or a string, and can involve any combination of column names, literals, operators, or functions.
Examples of the use of expressions in a query include:
In a products table, displaying a discounted price that is calculated by taking 10% off the retail price.
Displaying only the first three digits — the area code — of a phone number.
Displaying employee names in the format last_name, first_name.
Joining two tables, an orders table and a products table, then sorting the query on the total price (order quantity times product price).
In an orders table, copying and then deleting all orders that were shipped more than one year ago.
For more information about creating and using expressions, refer to the topics listed in the following table.
For information about |
See |
---|---|
Creating expressions |
|
Entering expressions into a query |
|
Using functions in expressions |
|
Using comparison operators in queries |
|
Using logical operators in queries |
|
Using operators in expressions |
|
Using predefined variables in expressions |
|
Using wildcard characters in queries |
|
Using user-defined functions in queries |