Additional Resources The following discussion describes the syntax for creating and dropping views, and shows some examples of how to use them. Additional Resources 25.5.1 View Syntax The  CREATE VIEW  statement creates a new view (see Section 13.1.23, “CREATE VIEW Statement” ). To alter the definition of a view or drop a view, use  ALTER VIEW  (see Section 13.1.11, “ALTER VIEW Statement” ), or  DROP VIEW  (see Section 13.1.35, “DROP VIEW Statement” ). A view can be created from many kinds of  SELECT  statements. It can refer to base tables or other views. It can use joins,  UNION , and subqueries. The  SELECT  need not even refer to any tables. The following example defines a view that selects two columns from another table, as well as an expression calculated from those columns: The optional  ALGORITHM  clause for  CREATE VIEW  or  ALTER VIEW  is a MySQL extension to standard SQL. It affects how MySQL processes the view.  ALGORITHM  takes three values:  MERGE ,  TEMPTABLE , or UNDEFINED . 25.5.2 View Processing Algorithms 4745 •If no  ALGORITHM  clause is present, the default algorithm is determined by the value of the derived_merge  flag of the  optimizer_switch  system variable. For additional discussion, see •For  UNDEFINED , MySQL chooses which algorithm to use. It prefers  MERGE  over  TEMPTABLE  if possible, because  MERGE  is usually more efficient and because a view cannot be updatable if a temporary table is used. •For  TEMPTABLE , the results from the view are retrieved into a temporary table, which then is used to execute the statement. •For  MERGE , the text of a statement that refers to the view and the view definition are merged such that parts of the view definition replace corresponding parts of the statement. mysql>  CREATE TABLE t (qty INT, price INT); mysql>  INSERT INTO t VALUES(3, 50), (5, 60); mysql>  CREATE VIEW v AS SELECT qty, price, qty*price AS value FROM t; mysql>  SELECT * FROM v; +------+-------+-------+ | qty | price | value | +------+-------+-------+ | 3 | 50 | 150 | | 5 | 60 | 300 | +------+-------+-------+ mysql>  SELECT * FROM v WHERE qty = 5; +------+-------+-------+ | qty | price | value | +------+-------+-------+ | 5 | 60 | 300 | +------+-------+-------+ •There are some restrictions on the use of views; see Section 25.9, “Restrictions on Views” . •For answers to some commonly asked questions regarding views in MySQL, see Section A.6, “MySQL 8.0 FAQ: Views” . •You may find the Views User Forum of use when working with views.