17.4. Operations on VIEWs as Constraints

VIEWs are virtual, logical tables that are from base tables in the physical schema. Ideally, the user should not be aware of the differences between a VIEW and a base table. Unfortunately, UPDATE, DELETE, or INSERT operations cannot be done directly on a VIEW. The operations have to resolve down to persistent base tables.

17.4.1. The Basic Three Operations

A base table is always updatable, but VIEWs are not always updatable. All an SQL engine knows about a VIEW is its definition, namely the query that specifies the table derived by the VIEW. An optimizer might be able to detect indexing and constraints on the base tables to construct an execution plan, but this can be pretty complicated.

There are three ...

Get Joe Celko's Thinking in Sets: Auxiliary, Temporal, and Virtual Tables in SQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.