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;
原文:http://www.cnblogs.com/zhuxiaolin/p/4916265.html