Computed Columns in View Definition

The first restriction applies to columns of views that are derived from computed columns or built-in functions, for example, the amt_due column in the accounts view shown here is a computed column:

CREATE VIEW accounts (title, advance, amt_due)
AS SELECT title_id, advance, (price * royalty/100) * ytd_sales
FROM titles
WHERE price > $15
AND advance > $5000

These are the rows visible through accounts:

SELECT * FROM accounts

title
advance
amt_due

--------
--------
---------

PC1035
7,000.00
32,240.16

PC8888
8,000.00
8,190.00

PS1372
7,000.00
809.63

TC3218
7,000.00
785.63


(4 row(s) affected)


Updates and inserts to the amt_due column are not allowed because there is no way to deduce the underlying values for price, royalty, or ytd_sales from any value you enter in amt_due column.