Setting Advanced View Properties

Algorithm
Algorithm is optional and it is a MySQL extension to standard SQL. Algorithm takes three values: Undefined, Merge or Temptable. The default algorithm is Undefined if no Algorithm clause is present. The algorithm affects how MySQL processes the view.

Undefined
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.

Merge
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.

Temptable
For Temptable, the results from the view are retrieved into a temporary table, which then is used to execute the statement.

Definer
The default Definer value is the user who executes the CREATE VIEW statement. (This is the same as DEFINER = CURRENT_USER.) If a user value is given, it should be a MySQL account in 'user_name'@'host_name' format (the same format used in the GRANT statement). The user_name and host_name values both are required.

Security
The SQL SECURITY characteristic determines which MySQL account to use when checking access privileges for the view when the view is executed. The legal characteristic values are Definer and Invoker. These indicate that the view must be executable by the user who defined it or invoked it, respectively. The default Security value is Definer.

Check option
The Check option can be given for an updatable view to prevent inserts or updates to rows except those for which the WHERE clause in the select_statement is true. The Local and Cascaded keywords determine the scope of check testing when the view is defined in terms of another view. Local restricts the Check option only to the view being defined. Cascaded causes the checks for underlying views to be evaluated as well. When neither keyword is given, the default is Cascaded.