@@ -110,7 +110,9 @@ try (ITableSession session =
110110After execution, you can verify the table creation using the following command:
111111
112112``` SQL
113- IoTDB> desc table1
113+ desc table1;
114+ ```
115+ ``` shell
114116+-----------+---------+-----------+
115117| ColumnName| DataType| Category|
116118+-----------+---------+-----------+
@@ -131,9 +133,9 @@ It is possible to insert data for specific columns. Columns not specified will r
131133** Example:**
132134
133135``` SQL
134- INSERT INTO table1(region, plant_id, device_id, time , temperature, humidity) VALUES (' Hamburg' , ' 1001' , ' 100' , ' 2025-11-26 13:37:00' , 90 .0 , 35 .1 )
136+ INSERT INTO table1(region, plant_id, device_id, time , temperature, humidity) VALUES (' Hamburg' , ' 1001' , ' 100' , ' 2025-11-26 13:37:00' , 90 .0 , 35 .1 );
135137
136- INSERT INTO table1(region, plant_id, device_id, time , temperature) VALUES (' Hamburg' , ' 1001' , ' 100' , ' 2025-11-26 13:38:00' , 91 .0 )
138+ INSERT INTO table1(region, plant_id, device_id, time , temperature) VALUES (' Hamburg' , ' 1001' , ' 100' , ' 2025-11-26 13:38:00' , 91 .0 );
137139```
138140
139141### 1.4 Null Value Insertion
@@ -145,10 +147,10 @@ You can explicitly set `null` values for tag columns, attribute columns, and fie
145147Equivalent to the above partial column insertion.
146148
147149``` SQL
148- # Equivalent to the example above
149- INSERT INTO table1(region, plant_id, device_id, model_id, maintenance, time , temperature, humidity) VALUES (' Hamburg' , ' 1001' , ' 100' , null , null , ' 2025-11-26 13:37:00' , 90 .0 , 35 .1 )
150+ # Equivalent to the example above;
151+ INSERT INTO table1(region, plant_id, device_id, model_id, maintenance, time , temperature, humidity) VALUES (' Hamburg' , ' 1001' , ' 100' , null , null , ' 2025-11-26 13:37:00' , 90 .0 , 35 .1 );
150152
151- INSERT INTO table1(region, plant_id, device_id, model_id, maintenance, time , temperature, humidity) VALUES (' Hamburg' , ' 1001' , ' 100' , null , null , ' 2025-11-26 13:38:00' , 91 .0 , null )
153+ INSERT INTO table1(region, plant_id, device_id, model_id, maintenance, time , temperature, humidity) VALUES (' Hamburg' , ' 1001' , ' 100' , null , null , ' 2025-11-26 13:38:00' , 91 .0 , null );
152154```
153155
154156If no tag columns are included, the system will automatically create a device with all tag column values set to ` null ` .
@@ -165,13 +167,13 @@ IoTDB supports inserting multiple rows of data in a single statement to improve
165167INSERT INTO table1
166168VALUES
167169(' 2025-11-26 13:37:00' , ' Frankfurt' , ' 1001' , ' 100' , ' A' , ' 180' , 90 .0 , 35 .1 , true, ' 2025-11-26 13:37:34' ),
168- (' 2025-11-26 13:38:00' , ' Frankfurt' , ' 1001' , ' 100' , ' A' , ' 180' , 90 .0 , 35 .1 , true, ' 2025-11-26 13:38:25' )
170+ (' 2025-11-26 13:38:00' , ' Frankfurt' , ' 1001' , ' 100' , ' A' , ' 180' , 90 .0 , 35 .1 , true, ' 2025-11-26 13:38:25' );
169171
170172INSERT INTO table1
171173(region, plant_id, device_id, model_id, maintenance, time , temperature, humidity, status, arrival_time)
172174VALUES
173175(' Frankfurt' , ' 1001' , ' 100' , ' A' , ' 180' , ' 2025-11-26 13:37:00' , 90 .0 , 35 .1 , true, ' 2025-11-26 13:37:34' ),
174- (' Frankfurt' , ' 1001' , ' 100' , ' A' , ' 180' , ' 2025-11-26 13:38:00' , 90 .0 , 35 .1 , true, ' 2025-11-26 13:38:25' )
176+ (' Frankfurt' , ' 1001' , ' 100' , ' A' , ' 180' , ' 2025-11-26 13:38:00' , 90 .0 , 35 .1 , true, ' 2025-11-26 13:38:25' );
175177```
176178
177179#### Notes
@@ -201,7 +203,7 @@ Using the [sample data](../Reference/Sample-Data.md) as the data source, first c
201203sql
202204
203205``` sql
204- IoTDB:database1 > CREATE TABLE target_table ( time TIMESTAMP TIME , region STRING TAG, device_id STRING TAG, temperature FLOAT FIELD );
206+ CREATE TABLE target_table ( time TIMESTAMP TIME , region STRING TAG, device_id STRING TAG, temperature FLOAT FIELD );
205207Msg: The statement is executed successfully.
206208```
207209
@@ -214,9 +216,13 @@ The `query` part is a direct `select ... from ...` query.
214216sql
215217
216218``` sql
217- IoTDB:database1 > insert into target_table select time ,region,device_id,temperature from table1 where region = ' Beijing'
219+ insert into target_table select time ,region,device_id,temperature from table1 where region = ' Beijing' ;
218220Msg: The statement is executed successfully.
219- IoTDB:database1> select * from target_table where region= ' Beijing'
221+ ```
222+ ``` sql
223+ select * from target_table where region= ' Beijing' ;
224+ ```
225+ ``` shell
220226+-----------------------------+--------+-----------+-------------+
221227| time| region| device_id| temperature|
222228+-----------------------------+--------+-----------+-------------+
@@ -243,9 +249,13 @@ The `query` part uses the table reference syntax `table source_table`.
243249sql
244250
245251``` sql
246- IoTDB:database1 > insert into target_table(time ,device_id,temperature) table table3
252+ insert into target_table(time ,device_id,temperature) table table3;
247253Msg: The statement is executed successfully.
248- IoTDB:database1> select * from target_table where region is null
254+ ```
255+ ``` sql
256+ select * from target_table where region is null ;
257+ ```
258+ ``` shell
249259+-----------------------------+------+-----------+-------------+
250260| time| region| device_id| temperature|
251261+-----------------------------+------+-----------+-------------+
@@ -270,9 +280,13 @@ The `query` part is a parenthesized subquery.
270280sql
271281
272282``` sql
273- IoTDB:database1 > insert into target_table (select t1 .time , t1 .region as region, t1 .device_id as device_id, t1 .temperature as temperature from table1 t1 where t1 .time in (select t2 .time from table2 t2 where t2 .region = ' Shanghai' ))
283+ insert into target_table (select t1 .time , t1 .region as region, t1 .device_id as device_id, t1 .temperature as temperature from table1 t1 where t1 .time in (select t2 .time from table2 t2 where t2 .region = ' Shanghai' ));
274284Msg: The statement is executed successfully.
275- IoTDB:database1> select * from target_table where region = ' Shanghai'
285+ ```
286+ ``` sql
287+ select * from target_table where region = ' Shanghai' ;
288+ ```
289+ ``` shell
276290+-----------------------------+---------+-----------+-------------+
277291| time| region| device_id| temperature|
278292+-----------------------------+---------+-----------+-------------+
@@ -339,13 +353,13 @@ INSERT INTO table1(time, device_id, s1) VALUES(NOW(), 'tag1', TO_OBJECT(TRUE, 0,
3393532 . ** Segmented write**
340354
341355``` SQL
342- -- First write: TO_OBJECT(FALSE, 0, X'696F')
356+ -- First write: TO_OBJECT(FALSE, 0, X'696F');
343357INSERT INTO table1(time , device_id, s1) VALUES (1 , ' tag1' , TO_OBJECT(FALSE, 0 , X' 696F' ));
344358
345- -- Second write: TO_OBJECT(FALSE, 2, X'7464')
359+ -- Second write: TO_OBJECT(FALSE, 2, X'7464');
346360INSERT INTO table1(time , device_id, s1) VALUES (1 , ' tag1' , TO_OBJECT(FALSE, 2 , X' 7464' ));
347361
348- -- Third write: TO_OBJECT(TRUE, 4, X'62')
362+ -- Third write: TO_OBJECT(TRUE, 4, X'62');
349363INSERT INTO table1(time , device_id, s1) VALUES (1 , ' tag1' , TO_OBJECT(TRUE, 4 , X' 62' ));
350364```
351365
@@ -379,5 +393,5 @@ updateAssignment
379393** Example** :
380394
381395``` SQL
382- update table1 set b = a where substring (a, 1 , 1 ) like ' %'
396+ update table1 set b = a where substring (a, 1 , 1 ) like ' %' ;
383397```
0 commit comments