Skip to content

Commit f7b7485

Browse files
committed
add show create table to table statement from 205
1 parent 2f06a75 commit f7b7485

24 files changed

+504
-128
lines changed

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

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,37 @@ IoTDB> desc tableB details
260260
+----------+---------+-----------+----------+-------+
261261
```
262262

263-
### 1.4 Update Tables
263+
264+
### 1.4 View Table Creation Statement
265+
266+
Retrieves the complete definition statement of a table or view under the table model. This feature automatically fills in all default values that were omitted during creation, so the displayed statement may differ from the original CREATE statement.
267+
268+
> This feature is supported starting from v2.0.5.
269+
270+
**Syntax:**
271+
272+
```SQL
273+
SHOW CREATE TABLE <TABLE_NAME>
274+
```
275+
276+
**Note::**
277+
278+
1. This statement does not support queries on system tables.
279+
280+
**Example:**
281+
282+
```SQL
283+
IoTDB:database1> show create table table1
284+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
285+
| Table| Create Table|
286+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
287+
|table1|CREATE TABLE "table1" ("region" STRING TAG,"plant_id" STRING TAG,"device_id" STRING TAG,"model_id" STRING ATTRIBUTE,"maintenance" STRING ATTRIBUTE,"temperature" FLOAT FIELD,"humidity" FLOAT FIELD,"status" BOOLEAN FIELD,"arrival_time" TIMESTAMP FIELD) WITH (ttl=31536000000)|
288+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
289+
Total line number = 1
290+
```
291+
292+
293+
### 1.5 Update Tables
264294

265295
Used to update a table, including adding or deleting columns and configuring table properties.
266296

@@ -291,7 +321,7 @@ COMMENT ON TABLE table1 IS 'table1'
291321
COMMENT ON COLUMN table1.a IS null
292322
```
293323

294-
### 1.5 Delete Tables
324+
### 1.6 Delete Tables
295325

296326
Used to delete a table.
297327

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

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,36 @@ IoTDB> desc tableB details
260260
+----------+---------+-----------+----------+-------+
261261
```
262262

263-
### 1.4 Update Tables
263+
### 1.4 View Table Creation Statement
264+
265+
Retrieves the complete definition statement of a table or view under the table model. This feature automatically fills in all default values that were omitted during creation, so the displayed statement may differ from the original CREATE statement.
266+
267+
> This feature is supported starting from v2.0.5.
268+
269+
**Syntax:**
270+
271+
```SQL
272+
SHOW CREATE TABLE <TABLE_NAME>
273+
```
274+
275+
**Note::**
276+
277+
1. This statement does not support queries on system tables.
278+
279+
**Example:**
280+
281+
```SQL
282+
IoTDB:database1> show create table table1
283+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
284+
| Table| Create Table|
285+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
286+
|table1|CREATE TABLE "table1" ("region" STRING TAG,"plant_id" STRING TAG,"device_id" STRING TAG,"model_id" STRING ATTRIBUTE,"maintenance" STRING ATTRIBUTE,"temperature" FLOAT FIELD,"humidity" FLOAT FIELD,"status" BOOLEAN FIELD,"arrival_time" TIMESTAMP FIELD) WITH (ttl=31536000000)|
287+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
288+
Total line number = 1
289+
```
290+
291+
292+
### 1.5 Update Tables
264293

265294
Used to update a table, including adding or deleting columns and configuring table properties.
266295

@@ -291,7 +320,7 @@ COMMENT ON TABLE table1 IS 'table1'
291320
COMMENT ON COLUMN table1.a IS null
292321
```
293322

294-
### 1.5 Delete Tables
323+
### 1.6 Delete Tables
295324

296325
Used to delete a table.
297326

src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_apache.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,30 @@ IoTDB> desc tableB details
264264
+----------+---------+-----------+----------+-------+
265265
```
266266

267-
### 2.4 Modify Table
267+
268+
### 2.4 View Table Creation Statement
269+
270+
**Syntax:**
271+
272+
```SQL
273+
SHOW CREATE TABLE <TABLE_NAME>
274+
```
275+
276+
**Examples:**
277+
278+
```SQL
279+
IoTDB:database1> show create table table1
280+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
281+
| Table| Create Table|
282+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
283+
|table1|CREATE TABLE "table1" ("region" STRING TAG,"plant_id" STRING TAG,"device_id" STRING TAG,"model_id" STRING ATTRIBUTE,"maintenance" STRING ATTRIBUTE,"temperature" FLOAT FIELD,"humidity" FLOAT FIELD,"status" BOOLEAN FIELD,"arrival_time" TIMESTAMP FIELD) WITH (ttl=31536000000)|
284+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
285+
Total line number = 1
286+
```
287+
288+
289+
290+
### 2.5 Modify Table
268291

269292
**Syntax:**
270293

@@ -286,7 +309,7 @@ COMMENT ON TABLE table1 IS 'table1'
286309
COMMENT ON COLUMN table1.a IS null
287310
```
288311

289-
### 2.5 Drop Table
312+
### 2.6 Drop Table
290313

291314
**Syntax:**
292315

src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,29 @@ IoTDB> desc tableB details
264264
+----------+---------+-----------+----------+-------+
265265
```
266266

267-
### 2.4 Modify Table
267+
268+
### 2.4 View Table Creation Statement
269+
270+
**Syntax:**
271+
272+
```SQL
273+
SHOW CREATE TABLE <TABLE_NAME>
274+
```
275+
276+
**Examples:**
277+
278+
```SQL
279+
IoTDB:database1> show create table table1
280+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
281+
| Table| Create Table|
282+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
283+
|table1|CREATE TABLE "table1" ("region" STRING TAG,"plant_id" STRING TAG,"device_id" STRING TAG,"model_id" STRING ATTRIBUTE,"maintenance" STRING ATTRIBUTE,"temperature" FLOAT FIELD,"humidity" FLOAT FIELD,"status" BOOLEAN FIELD,"arrival_time" TIMESTAMP FIELD) WITH (ttl=31536000000)|
284+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
285+
Total line number = 1
286+
```
287+
288+
289+
### 2.5 Modify Table
268290

269291
**Syntax:**
270292

@@ -286,7 +308,7 @@ COMMENT ON TABLE table1 IS 'table1'
286308
COMMENT ON COLUMN table1.a IS null
287309
```
288310

289-
### 2.5 Drop Table
311+
### 2.6 Drop Table
290312

291313
**Syntax:**
292314

src/UserGuide/Master/Table/User-Manual/Tree-to-Table_apache.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -261,29 +261,22 @@ IoTDB> show tables details from information_schema
261261
+--------------+-------+------+-------+-----------+
262262
```
263263

264-
#### 2.4.2 **`Show Create Table/View`**
264+
#### 2.4.2 **`Show Create View`**
265265
1. Syntax Definition
266266

267267
```SQL
268-
SHOW CREATE TABLE|VIEW viewname;
268+
SHOW CREATE VIEW viewname;
269269
```
270270

271271
2. Syntax Explanation
272272

273-
* The `SHOW CREATE TABLE`statement can be used to display the complete creation information for ordinary tables or views.
274-
* The `SHOW CREATE VIEW`statement can only be used to display the complete creation information for views.
275-
* Neither statement can be used to display system tables.
273+
* This statement retrieves the complete definition of a table or view.
274+
* It automatically fills in all default values omitted during creation, so the statement shown in the result may differ from the original CREATE statement.
275+
* This statement does not support system tables.
276276

277277
3. Usage Examples
278278

279279
```SQL
280-
IoTDB> show create table tableview
281-
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
282-
| View| Create View|
283-
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
284-
|tableview|CREATE VIEW "tableview" ("device" STRING TAG,"model" STRING TAG,"status" BOOLEAN FIELD,"hardware" STRING FIELD) COMMENT '树转表' WITH (ttl=INF) AS root.ln.**|
285-
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
286-
287280
IoTDB> show create view tableview
288281
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
289282
| View| Create View|
@@ -292,6 +285,9 @@ IoTDB> show create view tableview
292285
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
293286
```
294287

288+
> Additionally, you can also use the `SHOW CREATE TABLE` statement to view the creation information of table views. For more details, see [show create table](../Basic-Concept/Table-Management_apache.md#_1-4-view-table-creation-statement)
289+
290+
295291
### 2.5 Query Differences Between Non-aligned and Aligned Devices
296292

297293
Queries on tree-to-table views may yield different results compared to equivalent tree model `ALIGN BY DEVICE`queries when dealing with null values in aligned and non-aligned devices.

src/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -261,29 +261,22 @@ IoTDB> show tables details from information_schema
261261
+--------------+-------+------+-------+-----------+
262262
```
263263

264-
#### 2.4.2 **`Show Create Table/View`**
264+
#### 2.4.2 **`Show Create View`**
265265
1. Syntax Definition
266266

267267
```SQL
268-
SHOW CREATE TABLE|VIEW viewname;
268+
SHOW CREATE VIEW viewname;
269269
```
270270

271271
2. Syntax Explanation
272272

273-
* The `SHOW CREATE TABLE`statement can be used to display the complete creation information for ordinary tables or views.
274-
* The `SHOW CREATE VIEW`statement can only be used to display the complete creation information for views.
275-
* Neither statement can be used to display system tables.
273+
* This statement retrieves the complete definition of a table or view.
274+
* It automatically fills in all default values omitted during creation, so the statement shown in the result may differ from the original CREATE statement.
275+
* This statement does not support system tables.
276276

277277
3. Usage Examples
278278

279279
```SQL
280-
IoTDB> show create table tableview
281-
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
282-
| View| Create View|
283-
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
284-
|tableview|CREATE VIEW "tableview" ("device" STRING TAG,"model" STRING TAG,"status" BOOLEAN FIELD,"hardware" STRING FIELD) COMMENT '树转表' WITH (ttl=INF) AS root.ln.**|
285-
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
286-
287280
IoTDB> show create view tableview
288281
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
289282
| View| Create View|
@@ -292,6 +285,9 @@ IoTDB> show create view tableview
292285
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
293286
```
294287

288+
> Additionally, you can also use the `SHOW CREATE TABLE` statement to view the creation information of table views. For more details, see [show create table](../Basic-Concept/Table-Management_timecho.md#_1-4-view-table-creation-statement)
289+
290+
295291
### 2.5 Query Differences Between Non-aligned and Aligned Devices
296292

297293
Queries on tree-to-table views may yield different results compared to equivalent tree model `ALIGN BY DEVICE`queries when dealing with null values in aligned and non-aligned devices.

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

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,37 @@ IoTDB> desc tableB details
260260
+----------+---------+-----------+----------+-------+
261261
```
262262

263-
### 1.4 Update Tables
263+
264+
### 1.4 View Table Creation Statement
265+
266+
Retrieves the complete definition statement of a table or view under the table model. This feature automatically fills in all default values that were omitted during creation, so the displayed statement may differ from the original CREATE statement.
267+
268+
> This feature is supported starting from v2.0.5.
269+
270+
**Syntax:**
271+
272+
```SQL
273+
SHOW CREATE TABLE <TABLE_NAME>
274+
```
275+
276+
**Note::**
277+
278+
1. This statement does not support queries on system tables.
279+
280+
**Example:**
281+
282+
```SQL
283+
IoTDB:database1> show create table table1
284+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
285+
| Table| Create Table|
286+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
287+
|table1|CREATE TABLE "table1" ("region" STRING TAG,"plant_id" STRING TAG,"device_id" STRING TAG,"model_id" STRING ATTRIBUTE,"maintenance" STRING ATTRIBUTE,"temperature" FLOAT FIELD,"humidity" FLOAT FIELD,"status" BOOLEAN FIELD,"arrival_time" TIMESTAMP FIELD) WITH (ttl=31536000000)|
288+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
289+
Total line number = 1
290+
```
291+
292+
293+
### 1.5 Update Tables
264294

265295
Used to update a table, including adding or deleting columns and configuring table properties.
266296

@@ -291,7 +321,7 @@ COMMENT ON TABLE table1 IS 'table1'
291321
COMMENT ON COLUMN table1.a IS null
292322
```
293323

294-
### 1.5 Delete Tables
324+
### 1.6 Delete Tables
295325

296326
Used to delete a table.
297327

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

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,36 @@ IoTDB> desc tableB details
260260
+----------+---------+-----------+----------+-------+
261261
```
262262

263-
### 1.4 Update Tables
263+
### 1.4 View Table Creation Statement
264+
265+
Retrieves the complete definition statement of a table or view under the table model. This feature automatically fills in all default values that were omitted during creation, so the displayed statement may differ from the original CREATE statement.
266+
267+
> This feature is supported starting from v2.0.5.
268+
269+
**Syntax:**
270+
271+
```SQL
272+
SHOW CREATE TABLE <TABLE_NAME>
273+
```
274+
275+
**Note::**
276+
277+
1. This statement does not support queries on system tables.
278+
279+
**Example:**
280+
281+
```SQL
282+
IoTDB:database1> show create table table1
283+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
284+
| Table| Create Table|
285+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
286+
|table1|CREATE TABLE "table1" ("region" STRING TAG,"plant_id" STRING TAG,"device_id" STRING TAG,"model_id" STRING ATTRIBUTE,"maintenance" STRING ATTRIBUTE,"temperature" FLOAT FIELD,"humidity" FLOAT FIELD,"status" BOOLEAN FIELD,"arrival_time" TIMESTAMP FIELD) WITH (ttl=31536000000)|
287+
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
288+
Total line number = 1
289+
```
290+
291+
292+
### 1.5 Update Tables
264293

265294
Used to update a table, including adding or deleting columns and configuring table properties.
266295

@@ -291,7 +320,7 @@ COMMENT ON TABLE table1 IS 'table1'
291320
COMMENT ON COLUMN table1.a IS null
292321
```
293322

294-
### 1.5 Delete Tables
323+
### 1.6 Delete Tables
295324

296325
Used to delete a table.
297326

0 commit comments

Comments
 (0)