Search⌘ K

Updating a View

Explore how to update, insert, and delete data using updatable SQL views while learning the conditions that determine view updatability. This lesson helps you understand practical SQL commands to maintain data consistency between views and underlying tables.

We'll cover the following...

Updatable Views

Views are not only used to query data; they can also be used to update data in the underlying tables. It is possible to insert or update rows in the base table, and in the same vein, delete rows from the table using an updatable view. In order for a view to become updatable, it must abide by certain conditions.

If the SELECT query that creates the view has aggregate functions (MAX, MIN, COUNT, SUM, etc.), DISTINCT keyword, LEFT JOIN or GROUP BY, HAVING, and UNION clauses, the resulting view will not be updatable. Similarly, a subquery that refers to the same table that appears ...