When does a view get populated?
-
When it is created
-
When it is referenced in an INSERT statement
-
Any time an executable SQL statement references it
-
The first time any executable SQL statement references it
Views are virtual tables that don't store data - they execute the underlying query each time they're referenced. A view populates dynamically whenever any executable SQL statement (SELECT, INSERT, UPDATE, DELETE) references it. Views don't cache results and don't populate at creation time.
A view is just a stored query definition — it has no data of its own until it is actually queried. Each time any executable SQL statement references the view, the database re-runs the underlying query against the base tables to produce the result set. This is different from a materialized view, which does store data physically; a plain view is recomputed on every reference, not just once when created or first used.