数据库-day02复习

条件查询

distinct:表示去重,去除重复的数据

select distinct name from student;

like:模糊查询,模糊查询数据

select * from emp where name like "%a"  //以a结尾
select * from emp where name like "a%"  //以a开头
select * from emp where name like "%a%" //a在中间

null:过滤

select * from emp where name is null;
select * from emp where name is not null;

between   and:包含关系 [1000,3000]

select * from emp where sal >=1000 and sal<=3000;
select * from emp where sal between 1000 and 3000;

limit

select * from emp limit 3;  //查询前3行
select * from emp limit 1,2 //从第2行开始,查询2行 

order by

select * from emp order by sal// //默认升序
select * from emp order by sal desc;//降序

聚合函数

count(累加)   max(最大值)    min(最小值)   sum(总和)   avg(平均值)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值