O'Reilly logo

Microsoft® Access Projects with Microsoft SQL Server™ by Natascha Nicol, Ralf Albrecht

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Calculated Columns

Columns based on SELECT commands can also be calculated, which means they can be derived from other columns. The following query, for example, returns every film’s length, plus 45 minutes:

SELECT Filmtitle, Length + 45 FROM tblFilms

If you do not use AS to specify a column name for a calculated field, SQL Server/MSDE uses the name Expr< n >, with n denoting the column number.

You can use the following query to determine a product’s gross sales, plus value-added tax:

SELECT ProductNr, Description, SalesPrice * 1.16 
AS Gross FROM tblProducts

Table 9-1 lists the operators you can use to perform column calculations.

Table 9-1. Operators 
Operator Description
+ Addition
<;$MI> Subtraction
* Multiplication
/ Division ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required