表的增删改查

表的增删改查
#创建表
#主键:非空且唯一
#create table 表名(字段 类型,字段 类型);
#查看表的创建信息
#show tables; #查看所有的表
#desc 表名; #查看表结构(或者使用select * from 表名;
#show create table 表名; #查看指定的表
#
#增加字段:alter table 表名 add 字段名 类型;
#增加多个字段:alter table 表名 add 字段名 类型,add 字段名 类型;
# 修改字段类型:alter table 表名 modify 字段名 类型;
# 修改列名:alter talbe 表名 change 列名 新列se名 类型[first|after 字段名]
# 修改表名: rename talbe 旧表名 to 新表名;
#删除字段:alter table 表名 DROP 字段名;
#删除
#删除表:drop table 表名;
原文地址:https://www.cnblogs.com/shadowfolk/p/14706109.html