数据库删除,模糊查询,内外连接

删除数据库,表
DROP DATABASE db_name;
删除表
DROP TABLE table_name; 新增表记录insert
1.插入一条记录,对所有字段赋值
INSERT INTO tb_name VALUES (v1,v2,v3,....vn)
2.插入一条记录,对部分字段复制
INSERT INTO
tb_name(c1,c2,c3....,cn) VALUES(V1,V2,V3,...VN);
3.插入多条记录
INSERT INTO tb_name(c1,c2,c3,...,cn)
VALUES(v1,v2,v3,...vn),(v1,v2,v3...,vn),
VALUES(v1,v2,v3,...vn),(v1,v2,v3...,vn),
......; Like模糊查询
select * from member where regname ='nike';
select *from member where regname like 'nik%';
select *from member where regname like 'nik_';
distinct去重
select distinct 字段1,字段2.。。from 表名;
HAVING分组和group by 联合使用,筛选分组后的数据
where子句在聚合前先筛选记录,作用在group by和having子句钱,而having子句在聚合后对组记录进行筛选
对结果进行排序
order by field asc/desc
分页 limit m,n;
select * from member limit 10,10;
从第11条开始取10条记录
取出余额最多的会员,top语法
select * from member order by leaveamount desc limit1;
连接查询inner join on/using
select * from boys inner join girls on boys.matchNum=girls.matchNum;
select * from boys inner join girls using (matchNum);
union all/union 去除重复                        
上一篇:TF功能指南 | ​使用Device Manager管理TF物理路由器


下一篇:2018-2019-2 20175311 实验二 《Java开发环境的熟悉》实验报告