Home  >  Article  >  Database  >  mysql modify statement

mysql modify statement

王林
王林Original
2021-04-15 15:24:2317171browse

In mysql, you can use the [alter table old table name rename new table name;] statement to modify the table name, such as [mysql> alter table TYPE rename type;].

mysql modify statement

#The operating environment of this article: windows10 system, mysql 5.7, thinkpad t480 computer.

Mysql modification statement is as follows:

1. Modify table name

Usage: alter table old table name rename new table name;

mysql> alter table TYPE rename type;

2. Modify Column name of the table

Usage: alter table table name change old table name new table name type;

mysql> alter table type change name type_name varchar(30) not null;

3. Modify the type of a certain column of the table

Usage: alter table Table name modify column name type;

mysql> alter table type modify type_name varchar(100);

4. Add a column

Usage: alter table table name add column name type;

mysql> alter table type add age int(11);

5. Delete a column

Usage: alter table type drop column name;

mysql> alter table type drop age;

Free learning video sharing:mysql video tutorial

The above is the detailed content of mysql modify statement. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn