码迷,mamicode.com
首页 > 其他好文 > 详细

151027

时间:2015-10-28 09:31:13      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:

select t.*, t.rowid from T_HQ_RYXX t

select nianl,xingm from t_hq_ryxx;

select nianl as 年龄,xingm as 姓名 from t_hq_ryxx ;

select nianl 年龄 from t_hq_ryxx;

select nianl || xingm as 年龄和姓名 from t_hq_ryxx;

select nianl as g, t.* from t_hq_ryxx t order by xingb desc,bum nulls;

select * from t_hq_ryxx order by 2;

select * from t_hq_ryxx order by (gongz + nianl) desc;

select distinct bum,nianl from t_hq_ryxx;

select * from t_hq_ryxx;

select * from t_hq_ryxx where bum = 102 or bum = 101 and xingb = 2

select * from t_hq_ryxx where bum is not null;

--模糊查询 %通配符 _通配一位
select * from t_hq_ryxx where xingm like%的%;

select * from t_hq_ryxx where xingm like神__;

--值的范围
select * from t_hq_ryxx where nianl in (11,66);

select * from t_hq_ryxx where nianl = 11 or nianl =66;

--区间范围
select * from t_hq_ryxx where gongz between 10 and 800;

select * from t_hq_ryxx where gongz >= 100 and gongz <=300;

select * from t_hq_ryxx where bum in (select bumbm from t_hq_bm where lianxi = 545);

--大于最小值 小于最大值
select * from t_hq_ryxx where gongz > any (select pingjgz from t_hq_bm);

--大于最大值 小于最小值
select * from t_hq_ryxx where gongz < all (select pingjgz from t_hq_bm);

--分组
select bum, count(1) as 数量, avg(gongz) as 平均值, sum(gongz)  as 合计 from t_hq_ryxx group by bum having avg(gongz) > 100;

 

151027

标签:

原文地址:http://www.cnblogs.com/zhuxiaolin/p/4916265.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!