标签:11 -------- influxDB 查询 ---- weather select 操作 1001
influxDB-查询操作
1 #----综合使用 2 书写顺序 3 select distinct * from '表名' where '限制条件' group by '分组依据' having '过滤条件' order by limit '展示条数' 4 执行顺序 5 from -- 查询 6 where -- 限制条件 7 group by -- 分组 8 having -- 过滤条件 9 order by -- 排序 10 limit -- 展示条数 11 distinct -- 去重 12 select -- 查询的结果
1.查询数据表weather 的所有记录:
> select * from weather name: weather time altitude area humidity temperature ---- -------- ---- -------- ----------- 1607604432455278300 1001 南 -5 10 1607656595672442800 1000 东 -4 9 1607656662027484500 1001 南 -5 11 1607656706278952000 999 南 -5 11 1607656751612223600 1002 西 -2 11 1607656799728402900 1003 东 -2 11
2.按条件查询
#查询temperature=11的数据
> select * from weather where temperature=11
name: weather time altitude area humidity temperature ---- -------- ---- -------- ----------- 1607656662027484500 1001 南 -5 11 1607656706278952000 999 南 -5 11 1607656751612223600 1002 西 -2 11 1607656799728402900 1003 东 -2 11
#查询altitude,temperature两列的数据
> select altitude,temperature from weather
name: weather
time altitude temperature
---- -------- -----------
1607604432455278300 1001 10
1607656595672442800 1000 9
1607656662027484500 1001 11
1607656706278952000 999 11
1607656751612223600 1002 11
1607656799728402900 1003 11
3.排序
#按最新时间排序 > select * from weather order by time desc name: weather time altitude area humidity temperature ---- -------- ---- -------- ----------- 1607656799728402900 1003 东 -2 11 1607656751612223600 1002 西 -2 11 1607656706278952000 999 南 -5 11 1607656662027484500 1001 南 -5 11 1607656595672442800 1000 东 -4 9 1607604432455278300 1001 南 -5 10 #按最早时间排序 > select * from weather order by time asc name: weather time altitude area humidity temperature ---- -------- ---- -------- ----------- 1607604432455278300 1001 南 -5 10 1607656595672442800 1000 东 -4 9 1607656662027484500 1001 南 -5 11 1607656706278952000 999 南 -5 11 1607656751612223600 1002 西 -2 11 1607656799728402900 1003 东 -2 11
4.去重 (distinct)
> select distinct humidity from weather name: weather time distinct ---- -------- 0 -5 0 -4 0 -2
5.group by
select 查询字段1,查询字段2,... from 表名 where 过滤条件 group by分组依据 # 分组后取出的是每个组的第一条数据
6.聚合
7.limit限制条数
#显示一条信息 > select * from weather limit 1 name: weather time altitude area humidity temperature ---- -------- ---- -------- ----------- 1607604432455278300 1001 南 -5 10 #limit 10 offset 15,就是从第15行开始之后的10条数据 > select * from weather limit 2 offset 2 name: weather time altitude area humidity temperature ---- -------- ---- -------- ----------- 1607656662027484500 1001 南 -5 11 1607656706278952000 999 南 -5 11
8.or
influxDB中没有in的操作,但是有or。对于习惯了mysql的in来说,用or就需要在代码中循环了。
标签:11,--------,influxDB,查询,----,weather,select,操作,1001 来源: https://www.cnblogs.com/Bluebells/p/14120368.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。