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
productstable, 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
orderstable and a
productstable, then sorting the query on the total price (order quantity times product price).
- In an
orderstable, 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||Creating an Expression|
|Entering expressions into a query||Using Expressions in a Query|
|Creating summaries of data||Summarizing and Grouping|
|Using operators in expressions||Operators for Expressions|
|Using functions in expressions||Functions for Expressions|
|Using predefined variables in expressions||Predefined Variables for Expressions|