MySQL Common operations Section

Source: Internet
Author: User

For example, to modify the field username in the table user to name:

ALTER TABLE User change username name VARCHAR (20);

Other Modifications to table field information:

1. Add Field: Add field to table user password after ID;

ALTER TABLE user ADD COLUMN password VARCHAR (+) not NULL after ID;

2. Add PRIMARY key: Add ID to table user as primary key

ALTER TABLE user ADD PRIMARY KEY (ID);

3, when the primary key is added, if the primary key is an int type, in order to facilitate it to self-growth

ALTER TABLE user change ID ID INT (TEN) not NULL auto_increment;

4. Delete field: Delete table user's password field:

ALTER TABLE user DROP password;

No matter what the industry, as long as you do two things good enough, one is your professional, one is your character, professional decision of your existence, personality determines your network, the rest is to insist, with good professional and sincere win more trust. Do not forget to beginner's mind party always! Category: MySQL Note tags: mysql good text to the top attention to my collection of the text fantasy of the wheat field
Follow-1
Fans-4+ plus 00? Previous: Ubutun installation php7.1x
? Next: Failed at the @ Watch script ' cross-env node_env=development using CROSS-ENV to troubleshoot cross-platform settings node_env issues

MySQL Common operations Section

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.