July 2010
Intermediate to advanced
840 pages
16h 33m
English
Unlike base tables, VIEWs are either updatable or read-only, but not both. INSERT, UPDATE, and DELETE operations are allowed on updatable VIEWs and base tables, subject to any other constraints. INSERT, UPDATE, and DELETE are not allowed on read-only VIEWs, but you can change their base tables, as you would expect.
An updatable VIEW is one that can have each of its rows associated with exactly one row in an underlying base table. When the VIEW is changed, the changes pass unambiguously through the VIEW to that underlying base table. Updatable VIEWs in Standard SQL are defined only for queries that meet these criteria:
| 1. | Built on only one table |
| 2. | No GROUP BY clause |
| 3. | No HAVING clause |
| 4. | No aggregate functions |
Read now
Unlock full access