Name
ALTER VIEW
Synopsis
ALTER
[ALGORITHM = {UNDEFINED|MERGE|TEMPTABLE}]
[DEFINER = {'user'@'host'|CURRENT_USER}]
[SQL SECURITY {DEFINER|INVOKER }]
VIEW view [(column, ...)]
AS SELECT...
[WITH [CASCADED|LOCAL] CHECK OPTION]Use this statement to change a view. Views are available as of version 5.0.1 of MySQL.
The statement is used primarily to change the
SELECT statement that determines the view, which
you can do simply by placing the new SELECT
statement for the view after the AS keyword.
Change the column names provided by the view queries by
providing the new column names in a comma-separated list within the
parentheses following the view’s name. Don’t include either the old
SELECT statement or the old column names in the
statement.
The ALGORITHM parameter changes algorithmic
methods to use for processing a view: the choices are
MERGE or TEMPTABLE.
TEMPTABLE prevents a view from being
updatable.
The DEFINER clause can change the user
account considered to be the view’s creator. This clause is available
as of version 5.1.2 of MySQL. The same version introduced the related
SQL SECURITY clause. It instructs MySQL to
authorize access to the view based on the privileges of either the
user account of the view’s creator (DEFINER) or the
user account of the user who is querying the view
(INVOKER). This can help prevent some users from
accessing restricted views.
The WITH CHECK OPTION clause can change the
restrictions on the updating of a view to only rows in which the
WHERE clause of the underlying ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access