In MySQL, the View plays a good role to improve the web application performance in order to search data from database table. If you write a MySQL query to fetch data from multiple table y joining the two or more than two tables, then it will take some time to fetch the data from the database.
In this scenario, MySQL view will help you to fetch data from database tables. You can create a MySQL view to fetch data from multiple tables.
The MySQL view is a virtual table, which you can create a MySQL query by joining the multiple tables. Below is the syntax to create a MySQL view by using the query:
CREATE VIEW employee AS
SELECT emp_code, emp_name, salary
To see the just created view or select the data from the created view, use the below query:
SELECT * FROM employee;
In the above query “employee” is a MySQL view.
If you want to drop the created view from your database, then use the below query:
DROP VIEW employee;