首页 > 其他 > 详细

151027

时间:2015-10-28 09:28:01      阅读:161      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!