MySQL Foundation II

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.