首先创建一个用于测试的表test_table

drop table if exists test_table;
CREATE TABLE `test_table` (
  `id` int(11) DEFAULT NULL,
  `name` varchar(20) DEFAULT NULL,
  `age` int(11) DEFAULT NULL,
  `brief` varchar(100) DEFAULT NULL
);

在表的最后插入一列:

alter table test_table add column test_column1 varchar(20);

在表的某一列后插入一列:

alter table test_table add column test_column2 varchar(20) after name;

在表的开头插入一列:

alter table test_table add column test_column3 varchar(20) first;

删除某一列:

alter table test_table drop column test_column1;

修改某一列的类型:

alter table test_table modify column test_column2 integer;

相关文章:

  • 2021-05-16
  • 2021-09-04
  • 2021-09-21
  • 2021-12-25
  • 2022-02-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-21
  • 2022-12-23
  • 2021-05-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案