MySQL - Views Part 2: Managing Views
MySQL provides commands to manage views, including updating and deleting them.
Updating a View
You can redefine an existing view using the CREATE OR REPLACE syntax.
Example 1:
CREATE OR REPLACE VIEW EmployeeInfo AS
SELECT name, department
FROM employees;
Deleting a View
To remove a view, use the DROP VIEW command.
Example 2:
DROP VIEW EmployeeInfo;
Checking Existing Views
Example 3:
SHOW FULL TABLES WHERE TABLE_TYPE = 'VIEW';
Explanation:
Managing views effectively ensures database optimization and maintains the integrity of the queries they abstract.