Home > Database > Mysql Tutorial > body text

mysql modify statement

王林
Release: 2023-01-05 16:08:48
Original
17127 people have browsed it

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;
Copy after login

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;
Copy after login

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);
Copy after login

4. Add a column

Usage: alter table table name add column name type;

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

5. Delete a column

Usage: alter table type drop column name;

mysql> alter table type drop age;
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!