首页 > 数据库技术 > 详细

mysql

时间:2017-10-14 22:13:31      阅读:269      评论:0      收藏:0      [点我收藏+]

select * from students where id in(1,3,8);
select * from students where id between 3 and 8;
select * from students where id between 3 and 8 and gender=1;
select * from students where hometown is null;
select * from students where hometown is not null;
select * from students where hometown is not null and gender=0;

聚合函数
select count(*) from students;
select max(id) from students where gender=0;
select min(id) from students where isDelete=0;

select * from 表名 where 条件;
select * from 表名 group by 列1,列2,。。。、
select * from 表名 order by 列1 asc|desc,列2 asc|desc,...

select * from 表名 limit start,count;
select * from students where isDelete=0
limit (n-1)*m,m;

完整的 select 语句
select distinct * from 表名 where 条件
group by 列1,列2,... having 条件,条件,....聚合....
order by 列1,列2,....
limit start,count
执行顺序:
--from 表名
--where...
--group by...
--select distinct *
--having ...
--order by ...
--limit start,count

mysql

原文:http://www.cnblogs.com/shamezhi/p/7668674.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!