search

Home  >  Q&A  >  body text

mysql - sql 语句更改表结构,添加多个列,怎么写?

添加一个列是这样的:
ALTER TABLE tablename ADD 列名 数据类型
那多个呢?

PHP中文网PHP中文网2776 days ago619

reply all(3)I'll reply

  • 怪我咯

    怪我咯2017-04-17 15:01:58

    ALTER TABLE tablename ADD COLUMN column name data type, ADD COLUMN column name data type;

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 15:01:58

    Add column
    alter table mytable add name varchar(10)
    Delete column
    alter table mytable drop column name
    Modify column type
    alter table mytable alter column name nvarchar(10 )

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 15:01:58

    Add multiple columns:
    alter table mytable add name varchar(10), add name2 varchar(10); you can continue to add
    modify
    alter table mytable modify name varchar(10), modify name2 varchar (10);You can continue to add

    reply
    0
  • Cancelreply