VIEW

suggest change

Syntax

[OR REPLACE]
[ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
[DEFINER = { user | CURRENT_USER }]
[SQL SECURITY { DEFINER | INVOKER }]
VIEW view_name [(column_list)]
AS select_statement
[WITH [CASCADED | LOCAL] CHECK OPTION];  /// Full Create view syntax

Parameters

Parameters | Details | —— | —— | view_name | Name of View | SELECT statement | SQL statements to be packed in the views. It can be a SELECT statement to fetch data from one or more tables. |

Remarks

Views are virtual tables and do not contain the data that is returned. They can save you from writing complex queries again and again.

You have to create views, when you want to restrict few columns of your table, from the other user.

Performance. VIEWs are syntactic sugar. However there performance may or may not be worse than the equivalent query with the view’s select folded in. The Optimizer attempts to do this “fold in” for you, but is not always successful. MySQL 5.7.6 provides some more enhancements in the Optimizer. But, regardless, using a VIEW will not generate a faster query.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents