# 显示当前使用数据库 select database(); # 显示该数据库的所有表格 show tables; # 查询表格数据 select *
from student; # 数据的增删改查======================================= # curd的解释:
代表创建(Create)、更新(Update)、读取(Retrieve)和删除(Delete) # C 增 # 全列插入 insert into
student values(2, '老杨', 28, '177.77', '女', '1101'); # 部分列插入 insert into
student(gender) values('女'); # 全列多行一次性插入 insert into student values(4, '老杨',
28, '177.77', '女', '1101'), (5, '老杨', 28, '177.77', '女', '1101'); # 部分列,多行插入
insert into student(gender, cls_id) values('女', '1105'), ( '女', '1106'); # R
select * from student; # U UPDATE student set name = '老苟', age = 30 where id =
5; # D delete from student where gender = '男'; #
修改表的结构======================================= # 增加字段,追加后面,头,任意位置 alter table
student add object varchar(10); alter table student add first varchar(10)
first; alter table student add everyw varchar(10) after high; # 修改字段名 alter
table student change high height decimal(5,2); # 修改字段的类型 alter table student
change height height int; desc student; # 或 alter table student modify height
decimal(5,2); # 修改字段的顺序 alter table student change height height decimal(5,2)
after gender; # 或 alter table student modify height decimal(5,2) after everyw;
# 删除字段(不用加类型) alter table student drop object;
<>结果: