CREATE VIEW IF NOT EXISTS 视图名
AS
查询语句
CREATE VIEW myview
AS
SELECT last_name, department_name, job_title
FROM employees AS e
JOIN department AS d
ON e.department_id = d.department_id
JOIN jobs AS j
ON j.job_id = e.job_id;
DROP VIEW IF EXISTS 视图名;
方式1
CREATE OR REPLACE VIEW 视图名
AS
查询语句
方式2
ALTER VIEW 视图名
AS
查询语句
DESC 视图名;
SHOW CREATE VIEW 视图名;
SELECT *
FROM myview
WHERE last_name LIKE '%a%';