Using an Alias Name for a Column




If you create a query and display its result, by default, each column displays its caption as the name of the column. If you want, you can display a different caption for any column of your choice. To do this, display the query in Design View. Then, in the Field box that corresponds to the column, on the left side of the column name, type the caption of your choice, followed by :, and followed by the name of the column. Here is an example:


You can use the same technique to create aliases for other columns as you want. Here are examples:

When you execute the query, a column that received an alias would display it as its caption:

In SQL, an alias is created using the AS keyword as in the following formula:

ColumnName AS Alias

The ColumnName factor is the name of the column in the table (or query). The AS keyword is required. The Alias factor is the caption you want the column to display. Here are examples from the above query:

SELECT Properties.[Property #] AS [Prop #],
       Properties.[Property Type],
       Properties.Bedrooms AS Beds,
       Properties.Bathrooms AS Baths,
       Properties.[Year Built],
       Properties.[Market Value]
FROM Properties;



Home Copyright © 2008 FunctionX, Inc.