taos> create database epiot;
Query OK, 0 of 0 row(s) in database (0.001805s)
taos> use epiot;
Database changed.
taos> create table device_tag(ts timestamp,tag1 int,tag2 float,tag3 int,current float,vlotage int,phase float);
Query OK, 0 of 0 row(s) in database (0.005699s)
taos> insert into device_tag values(now,1,2.2,3,1.6,220,0.8);
Query OK, 1 of 1 row(s) in database (0.001876s)
taos> insert into device_tag values(now,1,2.2,3,1.6,220,0.5);
Query OK, 1 of 1 row(s) in database (0.000497s)
taos> insert into device_tag values(now,1,2.2,3,1.6,223,0.6);
Query OK, 1 of 1 row(s) in database (0.000488s)
taos> select * from device_tag;
ts | tag1 | tag2 | tag3 | current | vlotage | phase |
=========================================================================================================================================
2022-01-12 20:13:26.389 | 1 | 2.20000 | 3 | 1.60000 | 220 | 0.80000 |
2022-01-12 20:13:40.717 | 1 | 2.20000 | 3 | 1.60000 | 220 | 0.50000 |
2022-01-12 20:14:01.964 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
Query OK, 3 row(s) in set (0.013866s)
taos> select count(*) from device_tag
-> ;
count(*) |
========================
3 |
Query OK, 1 row(s) in set (0.002150s)
taos> insert into device_tag values(now,1,2.2,3,1.6,223,0.6);
Query OK, 1 of 1 row(s) in database (0.000491s)
taos> select avg(tag1) as tag1 ,sum(tag2) as tag2,max(current) as current ,max(vlotage) as voltage,min(phase) as phase from device_tag;
tag1 | tag2 | current | voltage | phase |
====================================================================================================================
1.000000000 | 85.800001860 | 1.60000 | 223 | 0.50000 |
Query OK, 1 row(s) in set (0.001567s)
taos> select * from device_tag;
ts | tag1 | tag2 | tag3 | current | vlotage | phase |
=========================================================================================================================================
2022-01-12 20:13:26.389 | 1 | 2.20000 | 3 | 1.60000 | 220 | 0.80000 |
2022-01-12 20:13:40.717 | 1 | 2.20000 | 3 | 1.60000 | 220 | 0.50000 |
2022-01-12 20:14:01.964 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:33:43.871 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:33:51.673 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:33:54.717 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:33:57.041 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:33:59.194 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:01.000 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:02.707 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:04.345 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:05.765 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
Query OK, 39 row(s) in set (0.001499s)
taos> select avg(tag1) as tag1 ,sum(tag2) as tag2,max(current) as current ,max(vlotage) as voltage,min(phase) as phase from device_tag where ts>'2022-01-12 20:34:43';
tag1 | tag2 | current | voltage | phase |
====================================================================================================================
1.000000000 | 6.600000143 | 1.60000 | 223 | 0.60000 |
Query OK, 1 row(s) in set (0.002726s)
taos> select * from device_tag where ts>='2022-01-12 20:34:07';
ts | tag1 | tag2 | tag3 | current | vlotage | phase |
=========================================================================================================================================
2022-01-12 20:34:07.302 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:08.974 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:11.008 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:13.559 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:15.263 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:17.513 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:20.080 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:22.511 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
taos> select * from device_tag where ts>='2022-01-12 20:34:20' and ts<='2022-01-12 20:34:30';
ts | tag1 | tag2 | tag3 | current | vlotage | phase |
=========================================================================================================================================
2022-01-12 20:34:20.080 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:22.511 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:25.280 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:26.943 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
2022-01-12 20:34:29.040 | 1 | 2.20000 | 3 | 1.60000 | 223 | 0.60000 |
Query OK, 5 row(s) in set (0.001292s)