| 表的创建 create table 表名(字段名 类型名 约束) # create table students( id int unsigned primary key auto_increment not null, name varchar(20) default '', age tinyint unsigned default 0, height decimal(5,2), gender enum('男','女','人妖','保密'), cls_id int unsigned default 0 ); # create table classes( id int unsigned auto_increment primary key not null, name varchar(10) ); | 查看数据库中所有表 show tables; | 查看创建语句 show create table classes; | 查看表结构,描述表 desc classes; - 修改字段 | 修改表-添加字段 add alter table students add birthday datetime; | 修改表-修改字段:不重命名版 modify alter table students modify birthday date; | 修改表-修改字段:重命名版 change alter table students change birthday birth date; | 修改表-删除字段 drop alter table students drop high; | 删除表 drop table students;
MySQL--数据表操作
原创
©著作权归作者所有:来自51CTO博客作者缪克拉的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:MySQL--基本语句操作
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
记录flink sql实时同步mysql数据表到mysql
关于大数据实时数据同步flink部分测试实验
flink mysql bc