Statement for modifying fields in mysql

Source: Internet
Author: User

The SQL statements described below are common statements used to modify fields in mysql. If you are a new user who just came into contact with the mysql database, take a look, it is helpful for you to learn how to modify mysql fields.

Modify the default value of a field in mysql

 
 
  1. alter table tb_mer_team_column drop constraint DF_tb_mer_team_column_columnOrder  
  2. alter table tb_mer_team_column add constraint DF_tb_mer_team_column_columnOrder default 0 for columnOrder 

Add fields in SQL statements

 
 
  1. Alter table table1 (table Name) add No_id (field name) char (12) (Field Type) t null | null UNIQUE after 'characters' added after the specified field

Modify the field type in mysql

 
 
  1. Alter table t1 (table Name) alter column a (field name) text (50) (field type)

Add a primary key field in SQL

 
 
  1. alter table tb_mer_basInfo add constraint [PK_tb_merchantBasInfo] primary key ( merchantID) 

SQL deletes a table Field

 
 
  1. alter table `lm_aclass` drop 'cpid' 


 

How to delete multiple tables in MySQL

How MySQL connects to remote SQL

MySQL cluster introduction and Configuration

Dedicated threads for MySQL memory usage

How to configure a MySQL cluster on Ubuntu 9.0

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.