您的位置:首页 > 其它

151027

2015-10-28 08:55 316 查看
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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: