数据写入。

语法

create_table_statement ::= insert into table_name'('
                              tag_name
                              (',' tag_name)* 
                              ',' time ','
                              field_name
                              (',' field_name)*
                           ')' values
                           ('('
                              tag_value
                              (',' tag_value)*
                              ',' time_value ','
                              field_value
                              (',' tag_value)*
                           ')')+

说明

参数 说明
tag_name 写入数据的Tag名称,与CREATE TABLE所指定的Tag对应,CREATE TABLE所指定的Tag列表必须都出现。必选。
time 写入数据的时间,单位ms,仅支持正整数,必选。
field_name 写入数据的列名,数据类型尽量与CREATE TABLE保持一致。否则以最新写入的数据为准。当某列未指定时,默认为null。

示例

  • 单条依次写入:
    insert into sensor (device_id, region, time, temperature, humidity) values('F07A1260','north-cn',1619076780000,12.1,45);
    insert into sensor (device_id, region, time, temperature, humidity) values('F07A1260','north-cn',1619076790000,13.2,47);
    insert into sensor (device_id, region, time, temperature, humidity) values('F07A1260','north-cn',1619076800000,10.6,46);
    insert into sensor (device_id, region, time, temperature, humidity) values('F07A1261','south-cn',1619076780000,18.1,44);
    insert into sensor (device_id, region, time, temperature, humidity) values('F07A1261','south-cn',1619076790000,19.7,44);
  • 批量写入:
    insert into sensor (device_id, region, time, temperature, humidity) values
        ('F07A1260','north-cn',1619076780000,12.1,45),
        ('F07A1260','north-cn',1619076790000,13.2,47),
        ('F07A1260','north-cn',1619076800000,10.6,46),
        ('F07A1261','south-cn',1619076780000,18.1,44),
        ('F07A1261','south-cn',1619076790000,19.7,44);