When the number of tables in the database is large, it is not conducive to maintenance. This article will detail how to maintain the mysql table, and how to modify the mysql table.
When the number of tables in the database is large, it is not conducive to maintenance. This article will detail how to maintain the mysql table, and how to modify the mysql table.
Change the Data Type of a column
[SQL]
Alter table visitor MODIFY nam VARCHAR (30 );
Append a new column
[SQL]
Alter table visitor ADD age INT;
Alter table visitor ADD age int first;
Alter table visitor ADD age int after nam;
Change column position
[SQL]
Alter table visitor MODIFY age int after nam;
Change column name and type
[SQL]
Alter table visitor CHANGE birth birthday DATE;
Delete column
[SQL]
Alter table visitor DROP age;
Table Replication
[SQL]
Create table customerH SELECT * FROM customer;
Create table customerG LIKE customer;
Insert into customerG SELECT * FROM customer;
Insert into tb1G (no) SELECT bang FROM tb1;
Table Deletion
[SQL]
Drop table if exists customerG;
Drop table customerG;