Skip to content

Commit c3f307a

Browse files
authored
fix table insert rules (#850)
* fix table insert rules * fix table insert rules
1 parent d10aa47 commit c3f307a

File tree

8 files changed

+21
-17
lines changed

8 files changed

+21
-17
lines changed

src/UserGuide/Master/Table/Basic-Concept/Write-Updata-Data.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ INSERT INTO <TABLE_NAME> [(COLUMN_NAME[, COLUMN_NAME]*)]? VALUES (COLUMN_VALUE[,
3939
4. If a column value does not exist for the identified device, the insertion will overwrite any existing `null` values with the new data.
4040
5. If a column value already exists for the identified device, a new insertion will update the column with the new value.
4141
6. Writing duplicate timestamps will update the values in the columns corresponding to the original timestamps.
42+
7. When an INSERT statement does not specify column names (e.g., INSERT INTO table VALUES (...)), the values in VALUES must strictly follow the physical order of columns in the table (this order can be checked via the DESC table command).
4243

4344
Since attributes generally do not change over time, it is recommended to update attribute values using the `UPDATE` statement described below,Please refer to the following [Data Update](#2-data-updates).
4445

@@ -164,8 +165,8 @@ IoTDB supports inserting multiple rows of data in a single statement to improve
164165
```SQL
165166
insert into table1
166167
values
167-
('Frankfurt', '3001', '3', '1', '10', 4, 90.0, 1200.0)
168-
('Frankfurt', '3001', '3', '1', '10', 5, 90.0, 1200.0)
168+
(4, 'Frankfurt', '3001', '3', '1', '10', 90.0, 1200.0)
169+
(5, 'Frankfurt', '3001', '3', '1', '10', 90.0, 1200.0)
169170
170171
171172
insert into table1

src/UserGuide/Master/Table/SQL-Manual/SQL-Data-Addition-Deletion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ VALUES ('Hunan', '3001', '3', NULL, NULL, 5, 90.0, NULL);
5656

5757
```SQL
5858
INSERT INTO table1 VALUES
59-
('Beijing', '3001', '3', '1', '10', 4, 90.0, 1200.0),
60-
('Beijing', '3001', '3', '1', '10', 5, 90.0, 1200.0);
59+
(4, 'Beijing', '3001', '3', '1', '10', 90.0, 1200.0),
60+
(5, 'Beijing', '3001', '3', '1', '10', 90.0, 1200.0);
6161

6262
INSERT INTO table1("Region", "PlantID", "DeviceID", Time, "Temperature", "Displacement")
6363
VALUES

src/UserGuide/latest-Table/Basic-Concept/Write-Updata-Data.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ INSERT INTO <TABLE_NAME> [(COLUMN_NAME[, COLUMN_NAME]*)]? VALUES (COLUMN_VALUE[,
3939
4. If a column value does not exist for the identified device, the insertion will overwrite any existing `null` values with the new data.
4040
5. If a column value already exists for the identified device, a new insertion will update the column with the new value.
4141
6. Writing duplicate timestamps will update the values in the columns corresponding to the original timestamps.
42+
7. When an INSERT statement does not specify column names (e.g., INSERT INTO table VALUES (...)), the values in VALUES must strictly follow the physical order of columns in the table (this order can be checked via the DESC table command).
4243

4344
Since attributes generally do not change over time, it is recommended to update attribute values using the `UPDATE` statement described below,Please refer to the following [Data Update](#2-data-updates).
4445

@@ -164,8 +165,8 @@ IoTDB supports inserting multiple rows of data in a single statement to improve
164165
```SQL
165166
insert into table1
166167
values
167-
('Frankfurt', '3001', '3', '1', '10', 4, 90.0, 1200.0)
168-
('Frankfurt', '3001', '3', '1', '10', 5, 90.0, 1200.0)
168+
(4, 'Frankfurt', '3001', '3', '1', '10', 90.0, 1200.0)
169+
(5, 'Frankfurt', '3001', '3', '1', '10', 90.0, 1200.0)
169170
170171
171172
insert into table1

src/UserGuide/latest-Table/SQL-Manual/SQL-Data-Addition-Deletion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ VALUES ('Hunan', '3001', '3', NULL, NULL, 5, 90.0, NULL);
5656

5757
```SQL
5858
INSERT INTO table1 VALUES
59-
('Beijing', '3001', '3', '1', '10', 4, 90.0, 1200.0),
60-
('Beijing', '3001', '3', '1', '10', 5, 90.0, 1200.0);
59+
(4, 'Beijing', '3001', '3', '1', '10', 90.0, 1200.0),
60+
(5, 'Beijing', '3001', '3', '1', '10', 90.0, 1200.0);
6161

6262
INSERT INTO table1("Region", "PlantID", "DeviceID", Time, "Temperature", "Displacement")
6363
VALUES

src/zh/UserGuide/Master/Table/Basic-Concept/Write-Updata-Data.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ INSERT INTO <TABLE_NAME> [(COLUMN_NAME[, COLUMN_NAME]*)]? VALUES (COLUMN_VALUE[,
3939
4. 若当前设备(由标识信息定位)不存在该属性列的值,执行写入操作将导致原有的空值(NULL)被写入的数据所替代。
4040
5. 若当前设备(由标识信息定位)已有属性列的值,再次写入相同的属性列时,系统将更新该属性列的值为新数据。
4141
6. 写入重复时间戳,原时间戳对应列的值会更新。
42+
7. 若 INSERT 语句未指定列名(如 INSERT INTO table VALUES (...)),则 VALUES中的值必须严格按表中列的物理顺序排列(顺序可通过 DESC table命令查看)。
4243

4344
由于属性一般并不随时间的变化而变化,因此推荐以 update 的方式单独更新属性值,参见下文 [数据更新](#数据更新)
4445

@@ -162,8 +163,8 @@ insert into table1("地区", "厂号", "设备号", "型号", "维修周期", Ti
162163
```SQL
163164
insert into table1
164165
values
165-
('北京', '3001', '3', '1', '10', 4, 90.0, 1200.0),
166-
('北京', '3001', '3', '1', '10', 5, 90.0, 1200.0);
166+
(4, '北京', '3001', '3', '1', '10', 90.0, 1200.0),
167+
(5, '北京', '3001', '3', '1', '10', 90.0, 1200.0);
167168
168169
169170
insert into table1

src/zh/UserGuide/Master/Table/SQL-Manual/SQL-Data-Addition-Deletion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ insert into table1("地区", "厂号", "设备号", "型号", "维修周期", Ti
5353
```SQL
5454
insert into table1
5555
values
56-
('北京', '3001', '3', '1', '10', 4, 90.0, 1200.0),
57-
('北京', '3001', '3', '1', '10', 5, 90.0, 1200.0);
56+
(4, '北京', '3001', '3', '1', '10', 90.0, 1200.0),
57+
(5, '北京', '3001', '3', '1', '10', 90.0, 1200.0);
5858
5959
insert into table1
6060
("地区", "厂号", "设备号", Time, "温度", "排量")

src/zh/UserGuide/latest-Table/Basic-Concept/Write-Updata-Data.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ INSERT INTO <TABLE_NAME> [(COLUMN_NAME[, COLUMN_NAME]*)]? VALUES (COLUMN_VALUE[,
3939
4. 若当前设备(由标识信息定位)不存在该属性列的值,执行写入操作将导致原有的空值(NULL)被写入的数据所替代。
4040
5. 若当前设备(由标识信息定位)已有属性列的值,再次写入相同的属性列时,系统将更新该属性列的值为新数据。
4141
6. 写入重复时间戳,原时间戳对应列的值会更新。
42+
7. 若 INSERT 语句未指定列名(如 INSERT INTO table VALUES (...)),则 VALUES中的值必须严格按表中列的物理顺序排列(顺序可通过 DESC table命令查看)。
4243

4344
由于属性一般并不随时间的变化而变化,因此推荐以 update 的方式单独更新属性值,参见下文 [数据更新](#数据更新)
4445

@@ -162,8 +163,8 @@ insert into table1("地区", "厂号", "设备号", "型号", "维修周期", Ti
162163
```SQL
163164
insert into table1
164165
values
165-
('北京', '3001', '3', '1', '10', 4, 90.0, 1200.0),
166-
('北京', '3001', '3', '1', '10', 5, 90.0, 1200.0);
166+
(4, 北京', '3001', '3', '1', '10', 90.0, 1200.0),
167+
(5, 北京', '3001', '3', '1', '10', 90.0, 1200.0);
167168
168169
169170
insert into table1
@@ -176,7 +177,7 @@ values
176177
#### 注意事项
177178
178179
- 如果在 SQL 语句中引用了表中不存在的列,IoTDB 将返回错误码 `COLUMN_NOT_EXIST(616)`。
179-
- 如果写入的数据类型与表中列的数据类型不一致,将报错 `DATA_TYPE_MISMATCH(507)`。
180+
- 如果写入的数据类型与表中列的数据类型不一致,将报错 `DATA_TYPE_MISMATCH(507)`。
180181
181182
## 2. 数据更新
182183

src/zh/UserGuide/latest-Table/SQL-Manual/SQL-Data-Addition-Deletion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ insert into table1("地区", "厂号", "设备号", "型号", "维修周期", Ti
5353
```SQL
5454
insert into table1
5555
values
56-
('北京', '3001', '3', '1', '10', 4, 90.0, 1200.0),
57-
('北京', '3001', '3', '1', '10', 5, 90.0, 1200.0);
56+
(4, '北京', '3001', '3', '1', '10', 90.0, 1200.0),
57+
(5, '北京', '3001', '3', '1', '10', 90.0, 1200.0);
5858
5959
insert into table1
6060
("地区", "厂号", "设备号", Time, "温度", "排量")

0 commit comments

Comments
 (0)