A view is a result of a SQL query. A view is not physically stored in the database. However, for a very complex query SQL uses the concept of materialized views where it actually stores the tables in the database as temporary tables. These tables acts as a normal database tables and all the regular table operations can be performed on this temporary table. When the queries are performed and when there is no use of the temporary tables, they are discarded.
Below given is the working and simple architecture of materialized views in SQL:
For a complex SQL query, temporary tables are created by the database management system. The results are stored in these temporary tables to be used in the queries. Once the stored data is used from the temporary tables, they are deleted from the database. These temporary tables are refreshed and modified as per the needs of the database.