Concept Flow - Updatable views
Create View
Query View
Update View Data?
Update Base Table
Reflect Changes in View
This flow shows how an update on a view is checked and either applied to the base table or rejected if not allowed.
CREATE VIEW v_emp AS SELECT id, name, salary FROM employees; UPDATE v_emp SET salary = salary + 100 WHERE id = 2;
| Step | Action | Evaluation | Result |
|---|---|---|---|
| 1 | Create view v_emp | View created on employees(id, name, salary) | View v_emp ready |
| 2 | Update v_emp set salary = salary + 100 where id = 2 | Check if view is updatable | View is updatable |
| 3 | Translate update to base table | Update employees set salary = salary + 100 where id = 2 | Base table updated |
| 4 | Reflect changes in view | Query view for id=2 | Salary increased by 100 |
| 5 | End | No more updates | Update complete |
| Variable | Start | After Step 3 | Final |
|---|---|---|---|
| salary (id=2) | 5000 | 5100 | 5100 |
CREATE VIEW view_name AS SELECT columns FROM table; Updates on simple views affect the base table directly. Only views without joins, aggregates, or complex expressions are updatable. Updating a view translates to updating the underlying table. If not updatable, update commands on the view fail.