Views are virtual tables which are stored SQL queries with certain given name. VIEW replaces a SELECT query with a given named view. A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database.
Create a view with an example:
1 2 | CREATE VIEW `View_name` AS SELECT select_statement; |
Call the View similar to Table
1 | SELECT * FROM View_name; |
How to Delete a View
1 | DROP VIEW view_name; |
Advantages of view in MySql
- The view is a little faster than the MySQL table
- The view is safer than mysql table
- Reduce data distraction
- It won’t take much space, as it is a virtual table.