First, view:
1, view definition: View is the result of the mapping of physical table, physical table change, view definitely change.
create view v_name as select 列名(也可以是函数计算出来的结果如 avg()) from 表;
2, the role of the view:
2.1. Permission control
For example, some columns allow users to query, other columns are not allowed.
You can use the view to open one or several columns, which acts as a permission control.
such as the purchase price in the commodity table, and other important information, the general user is not visible.
2.2, simplify the complex query statement.
3. Can the view be updated, deleted, added?
If each row of the view corresponds to a physical table one by one, you can change the physical table for the view.
View cannot be updated if the row of the view is calculated as a result of multiple rows in the physical table.
Second, the difference between delete and truncate:
1. Delete is DML, just delete the data in the table.
2, Truncate is DDL, first delete table, in CREATE table.
Example: Create a column from the growth of the table, the operation is a glance ....
MySQL Foundation II