基础命令
-
连接数据库
influx or influx -username='XXX' -password='XXX' -
查看数据库
show databases -
进入某个数据库
use db_name -
查看数据库下的表
show measurements -
查看field和tags
show tag keys from table_name show field keys from table_name -
转换时间展示格式
precision rfc3339
查询语句
-
时间范围查询
select * from table_name where time >='2022-07-11T10:00:00Z' tz('Asia/Shanghai') ## 转化为上海时间 -
查询以给定字段开始的数据
select * from table_name where fieldName=~/^给定字段/ -
查询以给定字段结束的数据
select * from table_name where fieldName=~/给定字段$/ -
模糊查询(like)
select * from table_name where fieldName=~/给定字段/ -
not like
select * from table_name where fieldName !~/给定字段/