Skip to content

Commit 7284fbe

Browse files
authored
adjust sql style in table mode (#1107)
1 parent a839dbc commit 7284fbe

52 files changed

Lines changed: 1406 additions & 1195 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/Database-Management_apache.md

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ This command is used to create a database.
5353
**Examples:**
5454

5555
```SQL
56-
CREATE DATABASE database1;
57-
CREATE DATABASE IF NOT EXISTS database1;
58-
59-
// Sets TTL to 1 year.
6056
CREATE DATABASE IF NOT EXISTS database1 with(TTL=31536000000);
6157
```
6258

@@ -73,7 +69,7 @@ USE <DATABASE_NAME>
7369
**Example:**
7470

7571
```SQL
76-
USE database1
72+
USE database1;
7773
```
7874

7975
### 1.3 View the Current Database
@@ -89,23 +85,18 @@ SHOW CURRENT_DATABASE
8985
**Example:**
9086

9187
```SQL
92-
IoTDB> SHOW CURRENT_DATABASE;
93-
+---------------+
94-
|CurrentDatabase|
95-
+---------------+
96-
| null|
97-
+---------------+
98-
99-
IoTDB> USE database1;
100-
101-
IoTDB> SHOW CURRENT_DATABASE;
88+
USE database1;
89+
SHOW CURRENT_DATABASE;
90+
```
91+
```shell
10292
+---------------+
10393
|CurrentDatabase|
10494
+---------------+
10595
| database1|
10696
+---------------+
10797
```
10898

99+
109100
### 1.4 View All Databases
110101

111102
Displays all databases and their properties.
@@ -131,15 +122,9 @@ SHOW DATABASES (DETAILS)?
131122
**Examples:**
132123

133124
```SQL
134-
IoTDB> show databases
135-
+------------------+-------+-----------------------+---------------------+---------------------+
136-
| Database|TTL(ms)|SchemaReplicationFactor|DataReplicationFactor|TimePartitionInterval|
137-
+------------------+-------+-----------------------+---------------------+---------------------+
138-
| database1| INF| 1| 1| 604800000|
139-
|information_schema| INF| null| null| null|
140-
+------------------+-------+-----------------------+---------------------+---------------------+
141-
142-
IoTDB> show databases details
125+
SHOW DATABASES DETAILS;
126+
```
127+
```shell
143128
+------------------+-------+-----------------------+---------------------+---------------------+--------------------+------------------+
144129
| Database|TTL(ms)|SchemaReplicationFactor|DataReplicationFactor|TimePartitionInterval|SchemaRegionGroupNum|DataRegionGroupNum|
145130
+------------------+-------+-----------------------+---------------------+---------------------+--------------------+------------------+
@@ -186,5 +171,5 @@ DROP DATABASE (IF EXISTS)? <DATABASE_NAME>
186171
**Example:**
187172

188173
```SQL
189-
DROP DATABASE IF EXISTS database1
174+
DROP DATABASE IF EXISTS database1;
190175
```

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

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ This command is used to create a database.
5353
**Examples:**
5454

5555
```SQL
56-
CREATE DATABASE database1;
57-
CREATE DATABASE IF NOT EXISTS database1;
58-
59-
// Sets TTL to 1 year.
6056
CREATE DATABASE IF NOT EXISTS database1 with(TTL=31536000000);
6157
```
6258

@@ -73,7 +69,7 @@ USE <DATABASE_NAME>
7369
**Example:**
7470

7571
```SQL
76-
USE database1
72+
USE database1;
7773
```
7874

7975
### 1.3 View the Current Database
@@ -89,23 +85,18 @@ SHOW CURRENT_DATABASE
8985
**Example:**
9086

9187
```SQL
92-
IoTDB> SHOW CURRENT_DATABASE;
93-
+---------------+
94-
|CurrentDatabase|
95-
+---------------+
96-
| null|
97-
+---------------+
98-
99-
IoTDB> USE database1;
100-
101-
IoTDB> SHOW CURRENT_DATABASE;
88+
USE database1;
89+
SHOW CURRENT_DATABASE;
90+
```
91+
```shell
10292
+---------------+
10393
|CurrentDatabase|
10494
+---------------+
10595
| database1|
10696
+---------------+
10797
```
10898

99+
109100
### 1.4 View All Databases
110101

111102
Displays all databases and their properties.
@@ -131,15 +122,9 @@ SHOW DATABASES (DETAILS)?
131122
**Examples:**
132123

133124
```SQL
134-
IoTDB> show databases
135-
+------------------+-------+-----------------------+---------------------+---------------------+
136-
| Database|TTL(ms)|SchemaReplicationFactor|DataReplicationFactor|TimePartitionInterval|
137-
+------------------+-------+-----------------------+---------------------+---------------------+
138-
| database1| INF| 1| 1| 604800000|
139-
|information_schema| INF| null| null| null|
140-
+------------------+-------+-----------------------+---------------------+---------------------+
141-
142-
IoTDB> show databases details
125+
SHOW DATABASES DETAILS;
126+
```
127+
```shell
143128
+------------------+-------+-----------------------+---------------------+---------------------+--------------------+------------------+
144129
| Database|TTL(ms)|SchemaReplicationFactor|DataReplicationFactor|TimePartitionInterval|SchemaRegionGroupNum|DataRegionGroupNum|
145130
+------------------+-------+-----------------------+---------------------+---------------------+--------------------+------------------+
@@ -186,5 +171,5 @@ DROP DATABASE (IF EXISTS)? <DATABASE_NAME>
186171
**Example:**
187172

188173
```SQL
189-
DROP DATABASE IF EXISTS database1
174+
DROP DATABASE IF EXISTS database1;
190175
```

src/UserGuide/Master/Table/Basic-Concept/Delete-Data.md

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,34 +69,21 @@ The [Example Data page](../Reference/Sample-Data.md)page provides SQL statements
6969
#### 1.2.1 Delet All Data from a Table
7070

7171
```SQL
72-
# Whole table deletion
73-
DELETE FROM table1
72+
DELETE FROM table1;
7473
```
7574

7675
#### 1.2.2 Delete Data within a Specific Time Range
7776

7877
```SQL
79-
# Single time interval deletion
80-
DELETE FROM table1 WHERE time <= 2024-11-29 00:00:00
81-
82-
# Multi time interval deletion
83-
DELETE FROM table1 WHERE time >= 2024-11-27 00:00:00 and time <= 2024-11-29 00:00:00
78+
DELETE FROM table1 WHERE time >= 2024-11-27 00:00:00 and time <= 2024-11-29 00:00:00;
8479
```
8580

8681
#### 1.2.3 Deleting Data for a Specific Device
8782

8883
```SQL
89-
# Device-specific deletion
90-
# Identifier conditions only support the '=' operator
91-
DELETE FROM table1 WHERE device_id='101' and model_id = 'B'
92-
93-
# Device-specific deletion with time interval
9484
DELETE FROM table1
9585
WHERE time >= 2024-11-27 16:39:00 and time <= 2024-11-29 16:42:00
96-
AND device_id='101' and model_id = 'B'
97-
98-
# Device-type-specific deletion
99-
DELETE FROM table1 WHERE model_id = 'B'
86+
AND device_id='101' and model_id = 'B';
10087
```
10188

10289
## 2. Device Deletion
@@ -117,5 +104,5 @@ DELETE DEVICES FROM tableName=qualifiedName (WHERE booleanExpression)?
117104
### 2.2 Example
118105

119106
```SQL
120-
DELETE DEVICES FROM table1 WHERE device_id = '101'
107+
DELETE DEVICES FROM table1 WHERE device_id = '101';
121108
```

src/UserGuide/Master/Table/Basic-Concept/TTL-Delete-Data_apache.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ If TTL is specified when creating a table using SQL, the table’s TTL takes pre
4747
Example 1: Setting TTL during table creation:
4848

4949
```SQL
50-
CREATE TABLE test3 ("site" string id, "temperature" int32) with (TTL=3600)
50+
CREATE TABLE test3 ("site" string id, "temperature" int32) with (TTL=3600);
5151
```
5252

5353
Example 2: Changing TTL for an existing table:
@@ -59,9 +59,9 @@ ALTER TABLE tableB SET PROPERTIES TTL=3600;
5959
**Example 3:** If TTL is not specified or set to the default value, it will inherit the database's TTL. By default, the database TTL is `'INF'` (infinite):
6060

6161
```SQL
62-
CREATE TABLE test3 ("site" string id, "temperature" int32) with (TTL=DEFAULT)
63-
CREATE TABLE test3 ("site" string id, "temperature" int32)
64-
ALTER TABLE tableB set properties TTL=DEFAULT
62+
CREATE TABLE test3 ("site" string id, "temperature" int32) with (TTL=DEFAULT);
63+
CREATE TABLE test3 ("site" string id, "temperature" int32);
64+
ALTER TABLE tableB set properties TTL=DEFAULT;
6565
```
6666

6767
### 2.2 Set TTL for Databases
@@ -71,33 +71,33 @@ Tables without explicit TTL settings inherit the TTL of their database. Refer to
7171
Example 4: A database with TTL=3600000 creates tables inheriting this TTL:
7272

7373
```SQL
74-
CREATE DATABASE db WITH (ttl=3600000)
75-
use db
76-
CREATE TABLE test3 ("site" string id, "temperature" int32)
74+
CREATE DATABASE db WITH (ttl=3600000);
75+
use db;
76+
CREATE TABLE test3 ("site" string id, "temperature" int32);
7777
```
7878

7979
Example 5: A database without a TTL setting creates tables without TTL:
8080

8181
```SQL
82-
CREATE DATABASE db
83-
use db
84-
CREATE TABLE test3 ("site" string id, "temperature" int32)
82+
CREATE DATABASE db;
83+
use db;
84+
CREATE TABLE test3 ("site" string id, "temperature" int32);
8585
```
8686

8787
Example 6: Setting a table with no TTL explicitly (TTL=INF) in a database with a configured TTL:
8888

8989
```SQL
90-
CREATE DATABASE db WITH (ttl=3600000)
91-
use db
92-
CREATE TABLE test3 ("site" string id, "temperature" int32) with (ttl='INF')
90+
CREATE DATABASE db WITH (ttl=3600000);
91+
use db;
92+
CREATE TABLE test3 ("site" string id, "temperature" int32) with (ttl='INF');
9393
```
9494

9595
## 3. Remove TTL
9696

9797
To cancel a TTL setting, modify the table's TTL to 'INF'. Note that IoTDB does not currently support modifying the TTL of a database.
9898

9999
```SQL
100-
ALTER TABLE tableB set properties TTL='INF'
100+
ALTER TABLE tableB set properties TTL='INF';
101101
```
102102

103103
## 4. View TTL Information
@@ -109,22 +109,22 @@ Use the SHOW DATABASES and SHOW TABLES commands to view TTL details for database
109109
Example Output:
110110

111111
```SQL
112-
IoTDB> show databases
112+
IoTDB> show databases;
113113
+---------+-------+-----------------------+---------------------+---------------------+
114114
| Database|TTL(ms)|SchemaReplicationFactor|DataReplicationFactor|TimePartitionInterval|
115115
+---------+-------+-----------------------+---------------------+---------------------+
116116
|test_prop| 300| 1| 3| 100000|
117117
| test2| 300| 1| 1| 604800000|
118118
+---------+-------+-----------------------+---------------------+---------------------+
119119

120-
IoTDB> show databases details
120+
IoTDB> show databases details;
121121
+---------+-------+-----------------------+---------------------+---------------------+-----+
122122
| Database|TTL(ms)|SchemaReplicationFactor|DataReplicationFactor|TimePartitionInterval|Model|
123123
+---------+-------+-----------------------+---------------------+---------------------+-----+
124124
|test_prop| 300| 1| 3| 100000|TABLE|
125125
| test2| 300| 1| 1| 604800000| TREE|
126126
+---------+-------+-----------------------+---------------------+---------------------+-----+
127-
IoTDB> show tables
127+
IoTDB> show tables;
128128
+---------+-------+
129129
|TableName|TTL(ms)|
130130
+---------+-------+
@@ -133,7 +133,7 @@ IoTDB> show tables
133133
| flower| INF|
134134
+---------+-------+
135135

136-
IoTDB> show tables details
136+
IoTDB> show tables details;
137137
+---------+-------+----------+
138138
|TableName|TTL(ms)| Status|
139139
+---------+-------+----------+

src/UserGuide/Master/Table/Basic-Concept/TTL-Delete-Data_timecho.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ If TTL is specified when creating a table using SQL, the table’s TTL takes pre
4747
Example 1: Setting TTL during table creation:
4848

4949
```SQL
50-
CREATE TABLE test3 ("site" string id, "temperature" int32) with (TTL=3600)
50+
CREATE TABLE test3 ("site" string id, "temperature" int32) with (TTL=3600);
5151
```
5252

5353
Example 2: Changing TTL for an existing table:
@@ -59,9 +59,9 @@ ALTER TABLE tableB SET PROPERTIES TTL=3600;
5959
**Example 3:** If TTL is not specified or set to the default value, it will inherit the database's TTL. By default, the database TTL is `'INF'` (infinite):
6060

6161
```SQL
62-
CREATE TABLE test3 ("site" string id, "temperature" int32) with (TTL=DEFAULT)
63-
CREATE TABLE test3 ("site" string id, "temperature" int32)
64-
ALTER TABLE tableB set properties TTL=DEFAULT
62+
CREATE TABLE test3 ("site" string id, "temperature" int32) with (TTL=DEFAULT);
63+
CREATE TABLE test3 ("site" string id, "temperature" int32);
64+
ALTER TABLE tableB set properties TTL=DEFAULT;
6565
```
6666

6767
### 2.2 Set TTL for Databases
@@ -71,33 +71,33 @@ Tables without explicit TTL settings inherit the TTL of their database. Refer to
7171
Example 4: A database with TTL=3600000 creates tables inheriting this TTL:
7272

7373
```SQL
74-
CREATE DATABASE db WITH (ttl=3600000)
75-
use db
76-
CREATE TABLE test3 ("site" string id, "temperature" int32)
74+
CREATE DATABASE db WITH (ttl=3600000);
75+
use db;
76+
CREATE TABLE test3 ("site" string id, "temperature" int32);
7777
```
7878

7979
Example 5: A database without a TTL setting creates tables without TTL:
8080

8181
```SQL
82-
CREATE DATABASE db
83-
use db
84-
CREATE TABLE test3 ("site" string id, "temperature" int32)
82+
CREATE DATABASE db;
83+
use db;
84+
CREATE TABLE test3 ("site" string id, "temperature" int32);
8585
```
8686

8787
Example 6: Setting a table with no TTL explicitly (TTL=INF) in a database with a configured TTL:
8888

8989
```SQL
90-
CREATE DATABASE db WITH (ttl=3600000)
91-
use db
92-
CREATE TABLE test3 ("site" string id, "temperature" int32) with (ttl='INF')
90+
CREATE DATABASE db WITH (ttl=3600000);
91+
use db;
92+
CREATE TABLE test3 ("site" string id, "temperature" int32) with (ttl='INF');
9393
```
9494

9595
## 3. Remove TTL
9696

9797
To cancel a TTL setting, modify the table's TTL to 'INF'. Note that IoTDB does not currently support modifying the TTL of a database.
9898

9999
```SQL
100-
ALTER TABLE tableB set properties TTL='INF'
100+
ALTER TABLE tableB set properties TTL='INF';
101101
```
102102

103103
## 4. View TTL Information
@@ -109,22 +109,22 @@ Use the SHOW DATABASES and SHOW TABLES commands to view TTL details for database
109109
Example Output:
110110

111111
```SQL
112-
IoTDB> show databases
112+
IoTDB> show databases;
113113
+---------+-------+-----------------------+---------------------+---------------------+
114114
| Database|TTL(ms)|SchemaReplicationFactor|DataReplicationFactor|TimePartitionInterval|
115115
+---------+-------+-----------------------+---------------------+---------------------+
116116
|test_prop| 300| 1| 3| 100000|
117117
| test2| 300| 1| 1| 604800000|
118118
+---------+-------+-----------------------+---------------------+---------------------+
119119

120-
IoTDB> show databases details
120+
IoTDB> show databases details;
121121
+---------+-------+-----------------------+---------------------+---------------------+-----+
122122
| Database|TTL(ms)|SchemaReplicationFactor|DataReplicationFactor|TimePartitionInterval|Model|
123123
+---------+-------+-----------------------+---------------------+---------------------+-----+
124124
|test_prop| 300| 1| 3| 100000|TABLE|
125125
| test2| 300| 1| 1| 604800000| TREE|
126126
+---------+-------+-----------------------+---------------------+---------------------+-----+
127-
IoTDB> show tables
127+
IoTDB> show tables;
128128
+---------+-------+
129129
|TableName|TTL(ms)|
130130
+---------+-------+
@@ -133,7 +133,7 @@ IoTDB> show tables
133133
| flower| INF|
134134
+---------+-------+
135135

136-
IoTDB> show tables details
136+
IoTDB> show tables details;
137137
+---------+-------+----------+
138138
|TableName|TTL(ms)| Status|
139139
+---------+-------+----------+

0 commit comments

Comments
 (0)