A computed column is a column whose content is computed from an expression using values from other columns in the table. The computed column is then filled with the results.
Simple computed expressions can be entered directly in the Computed Expression pane on the Detail tab of the column property sheet. For more complex expressions, use the SQL Editor available through the Edit tool found on the same tab.
Computed columns are not available in all DBMS.
Assume that you want to automatically fill a column with the total sales of widgets. To do this, you can create a computed column that will use the number of widgets multiplied by the widget price:
Column name |
Contents |
Action on data |
---|---|---|
Number of widgets |
Number of widgets sold |
— |
Widget price |
Price of widgets when sold |
— |
Widget sales |
Total widget sales |
Computed by multiplying the first two columns |
While our example is very simple, the SQL Editor allows you to define very complex computed column expressions.
For more information on the SQL Editor, see SQL Code Definition Toolbars.