1. Create
CREATE [or replace] [<algorithm attributes>] VIEW [database.] <name> [(<columns>)]
AS <select statement> [<check options>]
Example:
Create view 'view _ articles'
AS
SELECT
A. id AS id,
A. title AS title,
A. content AS content,
T. name AS tagname,
U. firstname AS "username"
FROM 'articles'a
Left join 'tags' t
ON a. tag_id = t. id
Left join 'users' u
ON a. user_id = u. id
Order by a. posttime DESC;
Modify
ALTER [<algorithm attributes>] VIEW [<database>.] <name> [(<columns>)]
AS <select statement> [<check options>]
Example:
Alter view 'view _ articles'
AS
SELECT
A. id AS id,
A. title AS title,
A. content AS content,
A. posttime AS posttime,
T. name AS tagname,
CONCAT (u. firstname, '', u. lastname) AS" username"
FROM 'articles'a
Left join 'tags' t
ON a. tag_id = t. id
Left join 'users' u
ON a. user_id = u. id
Order by a. posttime DESC;
The easiest way to modify a created visual chart is to export the SQL statement of the visual chart in phpMyAdmin, then modify the "CREATE" at the beginning (the "ALGORITHM = undefined definer = 'root' @ 'localhost' SQL SECURITY DEFINER" at the end) to "ALTER ", run the statement.