Skip to content

Commit b5d90cf

Browse files
authored
fix sql style (#1038)
1 parent 1de9f8d commit b5d90cf

48 files changed

Lines changed: 6911 additions & 6950 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/UserGuide/Master/Table/Basic-Concept/Table-Management_apache.md

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,19 @@ SHOW TABLES (DETAILS)? ((FROM | IN) database_name)?
127127
**Examples:**
128128

129129
```SQL
130-
IoTDB> show tables from database1
130+
show tables from database1;
131+
```
132+
```shell
131133
+---------+---------------+
132134
|TableName| TTL(ms)|
133135
+---------+---------------+
134136
| table1| 31536000000|
135137
+---------+---------------+
136-
137-
IoTDB> show tables details from database1
138+
```
139+
```sql
140+
show tables details from database1;
141+
```
142+
```shell
138143
+---------------+-----------+------+-------+
139144
| TableName| TTL(ms)|Status|Comment|
140145
+---------------+-----------+------+-------+
@@ -162,7 +167,9 @@ Used to view column names, data types, categories, and states of a table.
162167
**Examples:**
163168

164169
```SQL
165-
IoTDB> desc table1
170+
desc table1;
171+
```
172+
```shell
166173
+------------+---------+---------+
167174
| ColumnName| DataType| Category|
168175
+------------+---------+---------+
@@ -177,8 +184,11 @@ IoTDB> desc table1
177184
| status| BOOLEAN| FIELD|
178185
|arrival_time|TIMESTAMP| FIELD|
179186
+------------+---------+---------+
180-
181-
IoTDB> desc table1 details
187+
```
188+
```sql
189+
desc table1 details;
190+
```
191+
```shell
182192
+------------+---------+---------+------+------------+
183193
| ColumnName| DataType| Category|Status| Comment|
184194
+------------+---------+---------+------+------------+
@@ -215,7 +225,9 @@ SHOW CREATE TABLE <TABLE_NAME>
215225
**Example:**
216226

217227
```SQL
218-
IoTDB:database1> show create table table1
228+
show create table table1;
229+
```
230+
```shell
219231
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
220232
| Table| Create Table|
221233
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -232,12 +244,15 @@ Used to update a table, including adding or deleting columns and configuring tab
232244
**Syntax:**
233245

234246
```SQL
235-
ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? column=columnDefinition #addColumn
236-
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName DROP COLUMN (IF EXISTS)? column=identifier #dropColumn
237-
// set TTL can use this
238-
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES propertyAssignments #setTableProperties
239-
| COMMENT ON TABLE tableName=qualifiedName IS 'table_comment'
240-
| COMMENT ON COLUMN tableName.column IS 'column_comment'
247+
#addColumn;
248+
ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? column=columnDefinition;
249+
#dropColumn;
250+
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName DROP COLUMN (IF EXISTS)? column=identifier;
251+
#setTableProperties;
252+
// set TTL can use this;
253+
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES propertyAssignments;
254+
| COMMENT ON TABLE tableName=qualifiedName IS 'table_comment';
255+
| COMMENT ON COLUMN tableName.column IS 'column_comment';
241256
```
242257

243258
**Note::**
@@ -249,11 +264,11 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? col
249264
**Example:**
250265

251266
```SQL
252-
ALTER TABLE table1 ADD COLUMN IF NOT EXISTS a TAG COMMENT 'a'
253-
ALTER TABLE table1 ADD COLUMN IF NOT EXISTS b FLOAT FIELD COMMENT 'b'
254-
ALTER TABLE table1 set properties TTL=3600
255-
COMMENT ON TABLE table1 IS 'table1'
256-
COMMENT ON COLUMN table1.a IS null
267+
ALTER TABLE table1 ADD COLUMN IF NOT EXISTS a TAG COMMENT 'a';
268+
ALTER TABLE table1 ADD COLUMN IF NOT EXISTS b FLOAT FIELD COMMENT 'b';
269+
ALTER TABLE table1 set properties TTL=3600;
270+
COMMENT ON TABLE table1 IS 'table1';
271+
COMMENT ON COLUMN table1.a IS null;
257272
```
258273

259274
### 1.6 Delete Tables
@@ -269,6 +284,6 @@ DROP TABLE (IF EXISTS)? <TABLE_NAME>
269284
**Examples:**
270285

271286
```SQL
272-
DROP TABLE table1
273-
DROP TABLE database1.table1
287+
DROP TABLE table1;
288+
DROP TABLE database1.table1;
274289
```

src/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,19 @@ SHOW TABLES (DETAILS)? ((FROM | IN) database_name)?
127127
**Examples:**
128128

129129
```SQL
130-
IoTDB> show tables from database1
130+
show tables from database1;
131+
```
132+
```shell
131133
+---------+---------------+
132134
|TableName| TTL(ms)|
133135
+---------+---------------+
134136
| table1| 31536000000|
135137
+---------+---------------+
136-
137-
IoTDB> show tables details from database1
138+
```
139+
```sql
140+
show tables details from database1;
141+
```
142+
```shell
138143
+---------------+-----------+------+-------+
139144
| TableName| TTL(ms)|Status|Comment|
140145
+---------------+-----------+------+-------+
@@ -162,7 +167,9 @@ Used to view column names, data types, categories, and states of a table.
162167
**Examples:**
163168

164169
```SQL
165-
IoTDB> desc table1
170+
desc table1;
171+
```
172+
```shell
166173
+------------+---------+---------+
167174
| ColumnName| DataType| Category|
168175
+------------+---------+---------+
@@ -177,8 +184,11 @@ IoTDB> desc table1
177184
| status| BOOLEAN| FIELD|
178185
|arrival_time|TIMESTAMP| FIELD|
179186
+------------+---------+---------+
180-
181-
IoTDB> desc table1 details
187+
```
188+
```sql
189+
desc table1 details;
190+
```
191+
```shell
182192
+------------+---------+---------+------+------------+
183193
| ColumnName| DataType| Category|Status| Comment|
184194
+------------+---------+---------+------+------------+
@@ -214,7 +224,9 @@ SHOW CREATE TABLE <TABLE_NAME>
214224
**Example:**
215225

216226
```SQL
217-
IoTDB:database1> show create table table1
227+
show create table table1;
228+
```
229+
```shell
218230
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
219231
| Table| Create Table|
220232
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -231,12 +243,15 @@ Used to update a table, including adding or deleting columns and configuring tab
231243
**Syntax:**
232244

233245
```SQL
234-
ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? column=columnDefinition #addColumn
235-
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName DROP COLUMN (IF EXISTS)? column=identifier #dropColumn
236-
// set TTL can use this
237-
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES propertyAssignments #setTableProperties
238-
| COMMENT ON TABLE tableName=qualifiedName IS 'table_comment'
239-
| COMMENT ON COLUMN tableName.column IS 'column_comment'
246+
#addColumn;
247+
ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? column=columnDefinition;
248+
#dropColumn;
249+
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName DROP COLUMN (IF EXISTS)? column=identifier;
250+
#setTableProperties;
251+
// set TTL can use this;
252+
| ALTER TABLE (IF EXISTS)? tableName=qualifiedName SET PROPERTIES propertyAssignments;
253+
| COMMENT ON TABLE tableName=qualifiedName IS 'table_comment';
254+
| COMMENT ON COLUMN tableName.column IS 'column_comment';
240255
```
241256

242257
**Note::**
@@ -248,11 +263,11 @@ ALTER TABLE (IF EXISTS)? tableName=qualifiedName ADD COLUMN (IF NOT EXISTS)? col
248263
**Example:**
249264

250265
```SQL
251-
ALTER TABLE table1 ADD COLUMN IF NOT EXISTS a TAG COMMENT 'a'
252-
ALTER TABLE table1 ADD COLUMN IF NOT EXISTS b FLOAT FIELD COMMENT 'b'
253-
ALTER TABLE table1 set properties TTL=3600
254-
COMMENT ON TABLE table1 IS 'table1'
255-
COMMENT ON COLUMN table1.a IS null
266+
ALTER TABLE table1 ADD COLUMN IF NOT EXISTS a TAG COMMENT 'a';
267+
ALTER TABLE table1 ADD COLUMN IF NOT EXISTS b FLOAT FIELD COMMENT 'b';
268+
ALTER TABLE table1 set properties TTL=3600;
269+
COMMENT ON TABLE table1 IS 'table1';
270+
COMMENT ON COLUMN table1.a IS null;
256271
```
257272

258273
### 1.6 Delete Tables
@@ -268,6 +283,6 @@ DROP TABLE (IF EXISTS)? <TABLE_NAME>
268283
**Examples:**
269284

270285
```SQL
271-
DROP TABLE table1
272-
DROP TABLE database1.table1
286+
DROP TABLE table1;
287+
DROP TABLE database1.table1;
273288
```

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

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ try (ITableSession session =
110110
After 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
145147
Equivalent 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

154156
If 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
165167
INSERT INTO table1
166168
VALUES
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

170172
INSERT INTO table1
171173
(region, plant_id, device_id, model_id, maintenance, time, temperature, humidity, status, arrival_time)
172174
VALUES
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
201203
sql
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 );
205207
Msg: The statement is executed successfully.
206208
```
207209

@@ -214,9 +216,13 @@ The `query` part is a direct `select ... from ...` query.
214216
sql
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';
218220
Msg: 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`.
243249
sql
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;
247253
Msg: 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.
270280
sql
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'));
274284
Msg: 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,
339353
2. **Segmented write**
340354

341355
```SQL
342-
-- First write: TO_OBJECT(FALSE, 0, X'696F')
356+
-- First write: TO_OBJECT(FALSE, 0, X'696F');
343357
INSERT 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');
346360
INSERT 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');
349363
INSERT 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

Comments
 (0)