Mysql for cainiao: adding, modifying, and deleting Columns

Source: Internet
Author: User

Mysql for cainiao: adding, modifying, and deleting Columns

Test data:
 
 
 
I. Column addition:
1. alter table name column Declaration
The added columns are at the end of the table by default.
 
 
 
2. You can use "after" to specify which columns are behind the new columns.
 
 
 
3. If the new column is to be placed at the beginning of the table, use first
 
 
 
Ii. Column Modification

Alter table name change column name declaration to be modified

As shown in the table, the varchar length of name is 10, and now it is changed to 20.

 
 
 
 
 
Iii. Column deletion:

Alter table name: name of the column to be deleted

In this example, the height column is deleted as follows:
 
 
 

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.