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

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

作者:互联网

删除数据库,表
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 去除重复                        

标签:...,name,删除,数据库,vn,查询,member,v1,select
来源: https://www.cnblogs.com/JacquelineQA/p/12587139.html