Partager via


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

Structure of Expressions

Entering expressions into a query

How to: Use Expressions in Queries

Using functions in expressions

Functions for Expressions

Using comparison operators in queries

Comparison Operators (Visual Database Tools)

Using logical operators in queries

Logical Operators (Visual Database Tools)

Using operators in expressions

Operators for Expressions

Using predefined variables in expressions

Predefined Variables for Expressions

Using wildcard characters in queries

Wildcard Characters

Using user-defined functions in queries

How to: Include User-Defined Functions in Queries

See Also

Other Resources

Designing Queries and Views

Properties in Visual Database Tools