Views
A view can be thought of as a virtual table. It is a query that has been saved in a database with a name. The rows returned by the saved query can be seen as table contents, and the set of columns that form the result set can be seen as the table structure. Most SQL statements can refer to a view as if it were a table, and the user who writes those queries may not even know that he/she is using a view.
In MariaDB, sometimes the tables are called base tables to highlight the fact that they are not views.
There can be several reasons for using a view. For example, views can:
Avoid duplication of the same SQL code in several queries
Minimize the impact of changes in the underlying tables on the SQL code
Hide the complexity of the underlying tables
Hide information from the underlying tables
We will explore these concepts later. First, let's see how views can be managed using SQL statements.
Views can be managed using the following statements:
CREATE VIEW
ALTER VIEW
RENAME VIEW
DROP VIEW