Recall & Review
beginner
What is an updatable view in SQL?
An updatable view is a virtual table that allows you to insert, update, or delete rows through it, and these changes affect the underlying base tables.
Click to reveal answer
beginner
Name one common limitation of updatable views.
Views that use joins, aggregates, or groupings often cannot be updated because the database cannot clearly map changes back to the original tables.
Click to reveal answer
intermediate
Can you update a view that contains a GROUP BY clause?
No, views with GROUP BY clauses are generally not updatable because the data is aggregated and does not directly map to individual rows in the base tables.
Click to reveal answer
intermediate
What happens if you try to update a view that includes a join of multiple tables?
Most databases do not allow updates on views with joins because it is unclear which base table should be updated, leading to ambiguity.
Click to reveal answer
advanced
How can you make a non-updatable view updatable?
You can create INSTEAD OF triggers on the view to define custom actions for insert, update, or delete operations, making the view behave as updatable.
Click to reveal answer
Which of the following views is usually updatable?
✗ Incorrect
Views selecting from a single table without aggregates are typically updatable because changes map directly to the base table.
Why are views with joins often not updatable?
✗ Incorrect
Joins create ambiguity about which underlying table should be updated, so most databases disallow updates on such views.
What SQL feature can make a non-updatable view behave like an updatable one?
✗ Incorrect
INSTEAD OF triggers let you define custom update, insert, or delete actions on views, enabling updates even if the view is complex.
Can you update a view that uses aggregate functions like SUM or COUNT?
✗ Incorrect
Aggregate functions summarize data, so updates cannot be mapped back to individual rows in the base tables.
Which of these is NOT a limitation for updatable views?
✗ Incorrect
Selecting from a single table without complex clauses usually allows the view to be updatable.
Explain what makes a view updatable and list common limitations that prevent a view from being updatable.
Think about how the database knows where to apply changes.
You got /3 concepts.
Describe how INSTEAD OF triggers can help with updating views that are normally not updatable.
Triggers act like middlemen for view updates.
You got /3 concepts.