1、创建数据库

    create database if not exists db_name;

2、指定字符集

    create database if not exists db_name 

    character set utf8

3、创建表、删除表

    创建:create table tb_name (id int(4) not null primary key auto_increment, name char(20) not null);

    删除:drop table tb_name;

4、增加字段

   alter table tb_name add column age tinyint(2);

5、修改表名

   alter table tb_name rename to new_tb_name;

 

6、修改字段名

    alter table tb_name change column_name new_column_name [def] #字段类型 如int(4) char(1) 之类

7、修改字段属性

    alter table tb_name modify column_name [def]

8、删除字段用drop

相关文章:

  • 2022-12-23
  • 2021-05-26
  • 2021-08-31
  • 2021-09-29
  • 2022-12-23
  • 2021-12-11
  • 2022-03-09
  • 2022-12-23
猜你喜欢
  • 2022-01-07
  • 2021-08-22
  • 2021-10-16
  • 2021-07-07
  • 2021-05-12
  • 2021-11-16
  • 2021-12-21
相关资源
相似解决方案