When does a view get populated?
-
When it is created
-
When it is referenced in an INSERT statement
-
The first time any executable SQL statement references it
-
Any time an executable SQL statement references it
A view is a virtual table that stores only a query definition, not data. Every time an executable SQL statement references the view, the underlying query executes to produce the result set dynamically - the view is repopulated on each reference.
A standard (non-materialized) database view has no stored data of its own — its defining query is re-executed every time any SQL statement references it, so it gets 'populated' fresh on each reference. It isn't populated only once at creation or only the first time it's used; each subsequent query against the view re-runs the underlying SELECT.