未验证 提交 3313604e 编写于 作者: W wade zhang 提交者: GitHub

Update 06-subscribe.mdx

上级 87ad8375
...@@ -177,19 +177,19 @@ $ taos ...@@ -177,19 +177,19 @@ $ taos
### 准备数据 ### 准备数据
```sql ```sql
# 创建 power 库 # create database "power"
taos> create database power; taos> create database power;
# 切换库 # use "power" as the database in following operations
taos> use power; taos> use power;
# 创建超级表 # create super table "meters"
taos> create table meters(ts timestamp, current float, voltage int, phase int) tags(location binary(64), groupId int); taos> create table meters(ts timestamp, current float, voltage int, phase int) tags(location binary(64), groupId int);
# 创建表 # create tabes using the schema defined by super table "meters"
taos> create table d1001 using meters tags ("Beijing.Chaoyang", 2); taos> create table d1001 using meters tags ("Beijing.Chaoyang", 2);
taos> create table d1002 using meters tags ("Beijing.Haidian", 2); taos> create table d1002 using meters tags ("Beijing.Haidian", 2);
# 插入测试数据 # insert some rows
taos> insert into d1001 values("2020-08-15 12:00:00.000", 12, 220, 1),("2020-08-15 12:10:00.000", 12.3, 220, 2),("2020-08-15 12:20:00.000", 12.2, 220, 1); taos> insert into d1001 values("2020-08-15 12:00:00.000", 12, 220, 1),("2020-08-15 12:10:00.000", 12.3, 220, 2),("2020-08-15 12:20:00.000", 12.2, 220, 1);
taos> insert into d1002 values("2020-08-15 12:00:00.000", 9.9, 220, 1),("2020-08-15 12:10:00.000", 10.3, 220, 1),("2020-08-15 12:20:00.000", 11.2, 220, 1); taos> insert into d1002 values("2020-08-15 12:00:00.000", 9.9, 220, 1),("2020-08-15 12:10:00.000", 10.3, 220, 1),("2020-08-15 12:20:00.000", 11.2, 220, 1);
# 从超级表 meters 查询电流大于 10A 的记录 # filter out the rows in which current is bigger than 10A
taos> select * from meters where current > 10; taos> select * from meters where current > 10;
ts | current | voltage | phase | location | groupid | ts | current | voltage | phase | location | groupid |
=========================================================================================================== ===========================================================================================================
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册