You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2022/01/26 09:21:15 UTC

[iotdb] branch master updated: [IOTDB-2380] Add SQL for show and drop schema template (#4900)

This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 08d9d6b  [IOTDB-2380] Add SQL for show and drop schema template (#4900)
08d9d6b is described below

commit 08d9d6bbf0e07a9c833bbdd983b792df39adfc1b
Author: liuminghui233 <36...@users.noreply.github.com>
AuthorDate: Wed Jan 26 17:20:27 2022 +0800

    [IOTDB-2380] Add SQL for show and drop schema template (#4900)
---
 .../org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4    |  12 ++
 .../org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4   |  45 +++-
 docs/UserGuide/Operate-Metadata/Node.md            |  10 +-
 docs/UserGuide/Operate-Metadata/Storage-Group.md   |   8 +-
 docs/UserGuide/Operate-Metadata/TTL.md             |   8 +-
 docs/UserGuide/Operate-Metadata/Template.md        | 156 ++++++++++++--
 docs/UserGuide/Operate-Metadata/Timeseries.md      |  14 +-
 docs/UserGuide/Reference/Syntax-Conventions.md     |  24 ++-
 docs/zh/UserGuide/Operate-Metadata/Node.md         |  10 +-
 .../zh/UserGuide/Operate-Metadata/Storage-Group.md |   8 +-
 docs/zh/UserGuide/Operate-Metadata/TTL.md          |   8 +-
 docs/zh/UserGuide/Operate-Metadata/Template.md     | 156 ++++++++++++--
 docs/zh/UserGuide/Operate-Metadata/Timeseries.md   |  14 +-
 docs/zh/UserGuide/Reference/Syntax-Conventions.md  |  22 +-
 .../db/integration/IoTDBSchemaTemplateIT.java      | 227 ++++++++++++++++-----
 .../org/apache/iotdb/db/conf/IoTDBConstant.java    |   2 +
 .../apache/iotdb/db/qp/constant/SQLConstant.java   |  16 +-
 .../apache/iotdb/db/qp/executor/PlanExecutor.java  | 124 ++++++++---
 ...ShowOperator.java => DropTemplateOperator.java} |  40 ++--
 .../logical/sys/ShowNodesInTemplateOperator.java   |  43 ++++
 .../iotdb/db/qp/logical/sys/ShowOperator.java      |   3 +
 .../logical/sys/ShowPathsSetTemplateOperator.java  |  43 ++++
 .../sys/ShowPathsUsingTemplateOperator.java        |  43 ++++
 .../db/qp/logical/sys/ShowTemplatesOperator.java   |  27 +++
 .../qp/physical/sys/ShowNodesInTemplatePlan.java   |  34 +++
 .../qp/physical/sys/ShowPathsSetTemplatePlan.java  |  34 +++
 .../physical/sys/ShowPathsUsingTemplatePlan.java   |  34 +++
 .../apache/iotdb/db/qp/physical/sys/ShowPlan.java  |   6 +-
 .../db/qp/physical/sys/ShowTemplatesPlan.java      |  27 +++
 .../apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java    |  98 ++++++---
 site/src/main/.vuepress/config.js                  |   6 +-
 31 files changed, 1063 insertions(+), 239 deletions(-)

diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4 b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4
index 02d6ffe..024cf78 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4
@@ -69,6 +69,10 @@ ANY
     : A N Y
     ;
 
+APPEND
+    : A P P E N D
+    ;
+
 AS
     : A S
     ;
@@ -378,6 +382,10 @@ PROPERTY
     : P R O P E R T Y
     ;
 
+PRUNE
+    : P R U N E
+    ;
+
 QUERIES
     : Q U E R I E S
     ;
@@ -486,6 +494,10 @@ TEMPLATE
     : T E M P L A T E
     ;
 
+TEMPLATES
+    : T E M P L A T E S
+    ;
+
 TIME
     : T I M E
     ;
diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
index 822fdf7..7a2e82f 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
@@ -39,10 +39,12 @@ ddlStatement
     | createSchemaTemplate | createTimeseriesOfSchemaTemplate
     | createFunction | createTrigger | createContinuousQuery | createSnapshot
     | alterTimeseries | deleteStorageGroup | deleteTimeseries | deletePartition
-    | dropFunction | dropTrigger | dropContinuousQuery | setTTL | unsetTTL
-    | setSchemaTemplate | unsetSchemaTemplate | startTrigger | stopTrigger
+    | dropFunction | dropTrigger | dropContinuousQuery | dropSchemaTemplate
+    | setTTL | unsetTTL | startTrigger | stopTrigger | setSchemaTemplate | unsetSchemaTemplate
     | showStorageGroup | showDevices | showTimeseries | showChildPaths | showChildNodes
     | showFunctions | showTriggers | showContinuousQueries | showTTL | showAllTTL
+    | showSchemaTemplates | showNodesInSchemaTemplate
+    | showPathsUsingSchemaTemplate | showPathsSetSchemaTemplate
     | countStorageGroup | countDevices | countTimeseries | countNodes
     ;
 
@@ -89,19 +91,17 @@ alignedMeasurements
 
 // Create Schema Template
 createSchemaTemplate
-    : CREATE SCHEMA TEMPLATE templateName=identifier
-    LR_BRACKET templateMeasurementClause (COMMA templateMeasurementClause)* RR_BRACKET
+    : CREATE SCHEMA? TEMPLATE templateName=identifier
+    ALIGNED? LR_BRACKET templateMeasurementClause (COMMA templateMeasurementClause)* RR_BRACKET
     ;
 
 templateMeasurementClause
-    : suffixPath attributeClauses #nonAlignedTemplateMeasurement
-    | suffixPath LR_BRACKET nodeNameWithoutWildcard attributeClauses
-    (COMMA nodeNameWithoutWildcard attributeClauses)+ RR_BRACKET  #alignedTemplateMeasurement
+    : nodeNameWithoutWildcard attributeClauses
     ;
 
 // Create Timeseries Of Schema Template
 createTimeseriesOfSchemaTemplate
-    : CREATE TIMESERIES OF SCHEMA TEMPLATE ON prefixPath
+    : CREATE TIMESERIES OF SCHEMA? TEMPLATE ON prefixPath
     ;
 
 // Create Function
@@ -196,6 +196,11 @@ dropContinuousQuery
     : DROP (CONTINUOUS QUERY|CQ) continuousQueryName=identifier
     ;
 
+// Drop Schema Template
+dropSchemaTemplate
+    : DROP SCHEMA? TEMPLATE templateName=identifier
+    ;
+
 // Set TTL
 setTTL
     : SET TTL TO path=prefixPath time=INTEGER_LITERAL
@@ -208,12 +213,12 @@ unsetTTL
 
 // Set Schema Template
 setSchemaTemplate
-    : SET SCHEMA TEMPLATE templateName=identifier TO prefixPath
+    : SET SCHEMA? TEMPLATE templateName=identifier TO prefixPath
     ;
 
 // Unset Schema Template
 unsetSchemaTemplate
-    : UNSET SCHEMA TEMPLATE templateName=identifier FROM prefixPath
+    : UNSET SCHEMA? TEMPLATE templateName=identifier FROM prefixPath
     ;
 
 // Start Trigger
@@ -280,6 +285,26 @@ showAllTTL
     : SHOW ALL TTL
     ;
 
+// Show Schema Template
+showSchemaTemplates
+    : SHOW SCHEMA? TEMPLATES
+    ;
+
+// Show Measurements In Schema Template
+showNodesInSchemaTemplate
+    : SHOW NODES OPERATOR_IN SCHEMA? TEMPLATE templateName=identifier
+    ;
+
+// Show Paths Set Schema Template
+showPathsSetSchemaTemplate
+    : SHOW PATHS SET SCHEMA? TEMPLATE templateName=identifier
+    ;
+
+// Show Paths Using Schema Template
+showPathsUsingSchemaTemplate
+    : SHOW PATHS USING SCHEMA? TEMPLATE templateName=identifier
+    ;
+
 // Count Storage Group
 countStorageGroup
     : COUNT STORAGE GROUP prefixPath?
diff --git a/docs/UserGuide/Operate-Metadata/Node.md b/docs/UserGuide/Operate-Metadata/Node.md
index 1c3a598..3d0963b 100644
--- a/docs/UserGuide/Operate-Metadata/Node.md
+++ b/docs/UserGuide/Operate-Metadata/Node.md
@@ -19,8 +19,8 @@
 
 -->
 
-## Node Management
-### Show Child Paths
+# Node Management
+## Show Child Paths
 
 ```
 SHOW CHILD PATHS pathPattern
@@ -45,7 +45,7 @@ It costs 0.002s
 
 > get all paths in form of root.xx.xx.xx:show child paths root.xx.xx
 
-### Show Child Nodes
+## Show Child Nodes
 
 ```
 SHOW CHILD NODES pathPattern
@@ -76,7 +76,7 @@ Example:
 +------------+
 ```
 
-### Count Nodes
+## Count Nodes
 
 IoTDB is able to use `COUNT NODES <PathPattern> LEVEL=<INTEGER>` to count the number of nodes at
  the given level in current Metadata Tree considering a given pattern. IoTDB will find paths that
@@ -129,7 +129,7 @@ It costs 0.002s
 
 > Note: The path of timeseries is just a filter condition, which has no relationship with the definition of level.
 
-### Show Devices
+## Show Devices
 
 * SHOW DEVICES pathPattern? (WITH STORAGE GROUP)? limitClause? #showDevices
 
diff --git a/docs/UserGuide/Operate-Metadata/Storage-Group.md b/docs/UserGuide/Operate-Metadata/Storage-Group.md
index 32bc217..5961891 100644
--- a/docs/UserGuide/Operate-Metadata/Storage-Group.md
+++ b/docs/UserGuide/Operate-Metadata/Storage-Group.md
@@ -19,8 +19,8 @@
 
 -->
 
-## Storage Group Management
-### Create Storage Group
+# Storage Group Management
+## Create Storage Group
 
 According to the storage model we can set up the corresponding storage group. Two SQL statements are supported for creating storage groups, as follows:
 
@@ -43,7 +43,7 @@ The LayerName of storage group can only be characters, numbers, underscores and
  
 Besides, if deploy on Windows system, the LayerName is case-insensitive, which means it's not allowed to set storage groups `root.ln` and `root.LN` at the same time.
 
-### Show Storage Group
+## Show Storage Group
 
 After creating the storage group, we can use the [SHOW STORAGE GROUP](../Reference/SQL-Reference.md) statement and [SHOW STORAGE GROUP \<PathPattern>](../Reference/SQL-Reference.md) to view the storage groups. The SQL statements are as follows:
 
@@ -65,7 +65,7 @@ Total line number = 2
 It costs 0.060s
 ```
 
-### Delete Storage Group
+## Delete Storage Group
 
 User can use the `DELETE STORAGE GROUP <PathPattern>` statement to delete all storage groups matching the pathPattern. Please note the data in the storage group will also be deleted. 
 
diff --git a/docs/UserGuide/Operate-Metadata/TTL.md b/docs/UserGuide/Operate-Metadata/TTL.md
index 9fd6d11..5e41403 100644
--- a/docs/UserGuide/Operate-Metadata/TTL.md
+++ b/docs/UserGuide/Operate-Metadata/TTL.md
@@ -19,11 +19,11 @@
 
 -->
 
-## TTL
+# TTL
 
 IoTDB supports storage-level TTL settings, which means it is able to delete old data automatically and periodically. The benefit of using TTL is that hopefully you can control the total disk space usage and prevent the machine from running out of disks. Moreover, the query performance may downgrade as the total number of files goes up and the memory usage also increase as there are more files. Timely removing such files helps to keep at a high query performance level and reduce memory usage.
 
-### Set TTL
+## Set TTL
 
 The SQL Statement for setting TTL is as follow:
 
@@ -33,7 +33,7 @@ IoTDB> set ttl to root.ln 3600000
 
 This example means that for data in `root.ln`, only that of the latest 1 hour will remain, the older one is removed or made invisible.
 
-### Unset TTL
+## Unset TTL
 
 To unset TTL, we can use follwing SQL statement:
 
@@ -43,7 +43,7 @@ IoTDB> unset ttl to root.ln
 
 After unset TTL, all data will be accepted in `root.ln`
 
-### Show TTL
+## Show TTL
 
 To Show TTL, we can use following SQL statement:
 
diff --git a/docs/UserGuide/Operate-Metadata/Template.md b/docs/UserGuide/Operate-Metadata/Template.md
index a9eaae1..e9c0706 100644
--- a/docs/UserGuide/Operate-Metadata/Template.md
+++ b/docs/UserGuide/Operate-Metadata/Template.md
@@ -19,42 +19,172 @@
 
 -->
 
-## Schema Template
+# Schema Template
 
 IoTDB supports the schema template function, enabling different entities of the same type to share metadata, reduce the memory usage of metadata, and simplify the management of numerous entities and measurements.
 
-### Create Schema Template
+Note: The `schema` keyword in the following statements can be omitted.
 
-The SQL Statement for creating schema template is as follow:
+## Create Schema Template
 
+The SQL syntax for creating a metadata template is as follows:
+
+```sql
+CREATE SCHEMA? TEMPLATE <templateName> ALIGNED? '(' <measurementId> <attributeClauses> [',' <measurementId> <attributeClauses>]+ ')'
+```
+
+**Example 1:** Create a template containing two non-aligned timeseires
+
+```shell
+IoTDB> create schema template t1 (temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)
 ```
-IoTDB> create schema template temp1(GPS(lat FLOAT encoding=Gorilla, lon FLOAT encoding=Gorilla compression=SNAPPY), status BOOLEAN encoding=PLAIN compression=SNAPPY)
+
+**Example 2:** Create a template containing a group of aligned timeseires
+
+```shell
+IoTDB> create schema template t2 aligned (lat FLOAT encoding=Gorilla, lon FLOAT encoding=Gorilla)
 ```
 
-The` lat` and `lon` measurements under the `GPS` device are aligned.
+The` lat` and `lon` measurements are aligned.
 
-### Set Schema Template
+## Set Schema Template
 
 The SQL Statement for setting schema template is as follow:
 
-```
-IoTDB> set schema template temp1 to root.ln.wf01
+```shell
+IoTDB> set schema template t1 to root.sg1.d1
 ```
 
-After setting the schema template, you can insert data into the timeseries. For example, suppose there's a storage group root.ln and temp1 has been set to root.ln.wf01, then timeseries like root.ln.wf01.GPS.lat and root.ln.wf01.status are available and data points can be inserted.
+After setting the schema template, you can insert data into the timeseries. For example, suppose there's a storage group root.sg1 and t1 has been set to root.sg1.d1, then timeseries like root.sg1.d1.temperature and root.sg1.d1.status are available and data points can be inserted.
 
 **Attention**: Before inserting data, timeseries defined by the schema template will not be created. You can use the following SQL statement to create the timeseries before inserting data:
 
+```shell
+IoTDB> create timeseries of schema template on root.sg1.d1
 ```
-IoTDB> create timeseries of schema template on root.ln.wf01
+
+**Example:** Execute the following statement
+```shell
+set schema template t1 to root.sg1.d1
+set schema template t2 to root.sg1.d2
+create timeseries of schema template on root.sg1.d1
+create timeseries of schema template on root.sg1.d2
 ```
 
-### Uset Schema Template
+Show the time series:
+```sql
+show timeseries root.sg1.**
+````
+
+```shell
++-----------------------+-----+-------------+--------+--------+-----------+----+----------+
+|             timeseries|alias|storage group|dataType|encoding|compression|tags|attributes|
++-----------------------+-----+-------------+--------+--------+-----------+----+----------+
+|root.sg1.d1.temperature| null|     root.sg1|   FLOAT|     RLE|     SNAPPY|null|      null|
+|     root.sg1.d1.status| null|     root.sg1| BOOLEAN|   PLAIN|     SNAPPY|null|      null|
+|        root.sg1.d2.lon| null|     root.sg1|   FLOAT| GORILLA|     SNAPPY|null|      null|
+|        root.sg1.d2.lat| null|     root.sg1|   FLOAT| GORILLA|     SNAPPY|null|      null|
++-----------------------+-----+-------------+--------+--------+-----------+----+----------+
+```
 
-The SQL Statement for unsetting schema template is as follow:
+Show the devices:
+```sql
+show devices root.sg1.**
+````
+
+```shell
++---------------+---------+
+|        devices|isAligned|
++---------------+---------+
+|    root.sg1.d1|    false|
+|    root.sg1.d2|     true|
++---------------+---------+
+````
 
+## Show Schema Template
+
+- Show all schema templates
+
+The SQL statement looks like this:
+
+```shell
+IoTDB> show schema templates
+```
+
+The execution result is as follows:
+```shell
++-------------+
+|template name|
++-------------+
+|           t2|
+|           t1|
++-------------+
 ```
-IoTDB> unset schema template temp1 from root.beijing
+
+- Show nodes under in schema template
+
+The SQL statement looks like this:
+
+```shell
+IoTDB> show nodes in schema template t1
+```
+
+The execution result is as follows:
+```shell
++-----------+--------+--------+-----------+
+|child nodes|dataType|encoding|compression|
++-----------+--------+--------+-----------+
+|temperature|   FLOAT|     RLE|     SNAPPY|
+|     status| BOOLEAN|   PLAIN|     SNAPPY|
++-----------+--------+--------+-----------+
+```
+
+- Show the path prefix where a schema template is set
+
+```shell
+IoTDB> show paths set schema template t1
+```
+
+The execution result is as follows:
+```shell
++-----------+
+|child paths|
++-----------+
+|root.sg1.d1|
++-----------+
+```
+
+- Show the path prefix where a schema template is used (i.e. the time series has been created)
+
+```shell
+IoTDB> show paths using schema template t1
+```
+
+The execution result is as follows:
+```shell
++-----------+
+|child paths|
++-----------+
+|root.sg1.d1|
++-----------+
+```
+
+## Uset Schema Template
+
+The SQL Statement for unsetting schema template is as follow:
+
+```shell
+IoTDB> unset schema template t1 from root.sg1.d1
 ```
 
 **Attention**: Unsetting the template from entities, which have already inserted records using the template, is not supported.
+
+## Drop Schema Template
+
+The SQL Statement for dropping schema template is as follow:
+
+```shell
+IoTDB> drop schema template t1
+```
+
+**Attention**: Dropping an already set template is not supported.
\ No newline at end of file
diff --git a/docs/UserGuide/Operate-Metadata/Timeseries.md b/docs/UserGuide/Operate-Metadata/Timeseries.md
index 3539b24..362fbcf 100644
--- a/docs/UserGuide/Operate-Metadata/Timeseries.md
+++ b/docs/UserGuide/Operate-Metadata/Timeseries.md
@@ -19,9 +19,9 @@
 
 -->
 
-## Timeseries Management
+# Timeseries Management
 
-### Create Timeseries
+## Create Timeseries
 
 According to the storage model selected before, we can create corresponding timeseries in the two storage groups respectively. The SQL statements for creating timeseries are as follows:
 
@@ -54,7 +54,7 @@ error: encoding TS_2DIFF does not support BOOLEAN
 
 Please refer to [Encoding](../Data-Concept/Encoding.md) for correspondence between data type and encoding.
 
-### Create Aligned Timeseries (From v0.13)
+## Create Aligned Timeseries
 
 The SQL statement for creating a group of timeseries are as follows:
 
@@ -66,7 +66,7 @@ You can set different datatype, encoding, and compression for the timeseries in
 
 It is not currently supported to set an alias, tag, and attribute for aligned timeseries.
 
-### Delete Timeseries
+## Delete Timeseries
 
 To delete the timeseries we created before, we are able to use `DELETE TimeSeries <PathPattern>` statement.
 
@@ -78,7 +78,7 @@ IoTDB> delete timeseries root.ln.wf01.wt01.temperature, root.ln.wf02.wt02.hardwa
 IoTDB> delete timeseries root.ln.wf02.*
 ```
 
-### Show Timeseries
+## Show Timeseries
 
 * SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause?
 
@@ -178,7 +178,7 @@ show timeseries root.ln.** limit 10 offset 10
 It is worth noting that when the queried path does not exist, the system will return no timeseries.  
 
 
-### Count Timeseries
+## Count Timeseries
 
 IoTDB is able to use `COUNT TIMESERIES <Path>` to count the number of timeseries matching the path. SQL statements are as follows:
 
@@ -254,7 +254,7 @@ It costs 0.002s
 
 > Note: The path of timeseries is just a filter condition, which has no relationship with the definition of level.
 
-### Tag and Attribute Management
+## Tag and Attribute Management
 
 We can also add an alias, extra tag and attribute information while creating one timeseries.
 The SQL statements for creating timeseries with extra tag and attribute information are extended as follows:
diff --git a/docs/UserGuide/Reference/Syntax-Conventions.md b/docs/UserGuide/Reference/Syntax-Conventions.md
index 7885404..81b2167 100644
--- a/docs/UserGuide/Reference/Syntax-Conventions.md
+++ b/docs/UserGuide/Reference/Syntax-Conventions.md
@@ -19,11 +19,13 @@
 
 -->
 
-# Literal Values
+# Syntax Conventions
+
+## Literal Values
 
 This section describes how to write literal values in IoTDB. These include strings, numbers, timestamp values, boolean values, and NULL.
 
-## String Literals
+### String Literals
 
 A string is a sequence of characters, enclosed within either single quote (`'`) or double quote (`"`) characters. Examples:
 ```js
@@ -60,7 +62,7 @@ The following examples demonstrate how quoting and escaping work:
 "\"string"  // "string
 ```
 
-## Numeric Literals
+### Numeric Literals
 
 Number literals include integer (exact-value) literals and floating-point (approximate-value) literals.
 
@@ -74,22 +76,22 @@ The `FLOAT` and `DOUBLE` data types are floating-point types and calculations ar
 
 An integer may be used in floating-point context; it is interpreted as the equivalent floating-point number.
 
-## Timestamp Literals
+### Timestamp Literals
 
 The timestamp is the time point at which data is produced. It includes absolute timestamps and relative timestamps in IoTDB. For information about timestamp support in IoTDB, see [Data Type Doc](../Data-Concept/Data-Type.md).
 
 Specially, `NOW()` represents a constant timestamp that indicates the system time at which the statement began to execute.
 
-## Boolean Literals
+### Boolean Literals
 
 The constants `TRUE` and `FALSE` evaluate to 1 and 0, respectively. The constant names can be written in any lettercase.
 
-## NULL Values
+### NULL Values
 
 The `NULL` value means “no data.” `NULL` can be written in any lettercase.
 
 
-# Identifiers
+## Identifiers
 
 Certain objects within IoTDB, including `TRIGGER`, `FUNCTION`(UDF), `CONTINUOUS QUERY`, `SCHEMA TEMPLATE`, `USER`, `ROLE` and other object names are known as identifiers.
 
@@ -122,7 +124,7 @@ Identifier quote characters can be included within an identifier if you quote th
 `a\`b`  // parsed as a`b
 ```
 
-# Node Names in Path
+## Node Names in Path
 
 We call the part of a path divided by `.` as a `node`. 
 
@@ -158,14 +160,14 @@ CREATE TIMESERIES root.a.b."s1.s2".c WITH DATATYPE=INT32, ENCODING=RLE
 // root.a.b."s1.s2".c will be parsed as Path[root, a, b, "s1.s2", c]
 ```
 
-# Keywords and Reserved Words
+## Keywords and Reserved Words
 
 Keywords are words that have significance in SQL require special treatment for use as identifiers and node names, and need to be escaped with backticks.
 Certain keywords, such as TIME and ROOT, are reserved and cannot use as identifiers and node names (even after escaping).
 
 [Keywords and Reserved Words](Keywords.md) shows the keywords and reserved words in IoTDB 0.13.
 
-# Expressions
+## Expressions
 
 IoTDB supports the execution of arbitrary nested expressions consisting of numbers, time series, arithmetic expressions, and time series generating functions (including user-defined functions) in the `select` clause.
 
@@ -180,7 +182,7 @@ select `0` + 0 from root.sg.d -- valid expression, add number 0 to each point of
 select myudf(`'a'`, 'x') from root.sg.d -- valid expression, call function myudf with timeseries root.sg.d.'a' as the 1st parameter, and a string constant 'x' as the 2nd parameter
 ```
 
-# Learn More
+## Learn More
 
 Please read the lexical and grammar description files in our code repository:
 
diff --git a/docs/zh/UserGuide/Operate-Metadata/Node.md b/docs/zh/UserGuide/Operate-Metadata/Node.md
index 1e5b067..e75eb6c 100644
--- a/docs/zh/UserGuide/Operate-Metadata/Node.md
+++ b/docs/zh/UserGuide/Operate-Metadata/Node.md
@@ -19,9 +19,9 @@
 
 -->
 
-## 节点管理
+# 节点管理
 
-### 查看子路径
+## 查看子路径
 
 ```
 SHOW CHILD PATHS pathPattern
@@ -53,7 +53,7 @@ SHOW CHILD PATHS pathPattern
 +---------------+
 ```
 
-### 查看子节点
+## 查看子节点
 
 ```
 SHOW CHILD NODES pathPattern
@@ -84,7 +84,7 @@ SHOW CHILD NODES pathPattern
 +------------+
 ```
 
-### 统计节点数
+## 统计节点数
 
 IoTDB 支持使用`COUNT NODES <PathPattern> LEVEL=<INTEGER>`来统计当前 Metadata
  树下满足某路径模式的路径中指定层级的节点个数。这条语句可以用来统计带有特定采样点的设备数。例如:
@@ -134,7 +134,7 @@ It costs 0.002s
 
 > 注意:时间序列的路径只是过滤条件,与 level 的定义无关。
 
-### 查看设备
+## 查看设备
 
 * SHOW DEVICES pathPattern? (WITH STORAGE GROUP)? limitClause? #showDevices
 
diff --git a/docs/zh/UserGuide/Operate-Metadata/Storage-Group.md b/docs/zh/UserGuide/Operate-Metadata/Storage-Group.md
index 9b72a3e..4b16ce1 100644
--- a/docs/zh/UserGuide/Operate-Metadata/Storage-Group.md
+++ b/docs/zh/UserGuide/Operate-Metadata/Storage-Group.md
@@ -19,9 +19,9 @@
 
 -->
 
-## 存储组管理
+# 存储组管理
 
-### 创建存储组
+## 创建存储组
 
 我们可以根据存储模型建立相应的存储组。创建存储组支持两种 SQL 语句,如下所示:
 
@@ -44,7 +44,7 @@ Msg: 300: root.ln has already been set to storage group.
 
 还需注意,如果在 Windows 系统上部署,存储组名是大小写不敏感的。例如同时创建`root.ln` 和 `root.LN` 是不被允许的。
 
-### 查看存储组
+## 查看存储组
 
 在存储组创建后,我们可以使用 [SHOW STORAGE GROUP](../Reference/SQL-Reference.md) 语句和 [SHOW STORAGE GROUP \<PathPattern>](../Reference/SQL-Reference.md) 来查看存储组,SQL 语句如下所示:
 
@@ -67,7 +67,7 @@ Total line number = 2
 It costs 0.060s
 ```
 
-### 删除存储组
+## 删除存储组
 
 用户可以使用`DELETE STORAGE GROUP <PathPattern>`语句删除该路径模式匹配的所有的存储组。在删除的过程中,需要注意的是存储组的数据也会被删除。
 
diff --git a/docs/zh/UserGuide/Operate-Metadata/TTL.md b/docs/zh/UserGuide/Operate-Metadata/TTL.md
index d9b2c46..49888db 100644
--- a/docs/zh/UserGuide/Operate-Metadata/TTL.md
+++ b/docs/zh/UserGuide/Operate-Metadata/TTL.md
@@ -19,13 +19,13 @@
 
 -->
 
-## 数据存活时间(TTL)
+# 数据存活时间(TTL)
 
 IoTDB 支持对存储组级别设置数据存活时间(TTL),这使得 IoTDB 可以定期、自动地删除一定时间之前的数据。合理使用 TTL
 可以帮助您控制 IoTDB 占用的总磁盘空间以避免出现磁盘写满等异常。并且,随着文件数量的增多,查询性能往往随之下降,
 内存占用也会有所提高。及时地删除一些较老的文件有助于使查询性能维持在一个较高的水平和减少内存资源的占用。
 
-### 设置 TTL
+## 设置 TTL
 
 设置 TTL 的 SQL 语句如下所示:
 ```
@@ -33,7 +33,7 @@ IoTDB> set ttl to root.ln 3600000
 ```
 这个例子表示在`root.ln`存储组中,只有最近一个小时的数据将会保存,旧数据会被移除或不可见。
 
-### 取消 TTL
+## 取消 TTL
 
 取消 TTL 的 SQL 语句如下所示:
 
@@ -43,7 +43,7 @@ IoTDB> unset ttl to root.ln
 
 取消设置 TTL 后,存储组`root.ln`中所有的数据都会被保存。
 
-### 显示 TTL
+## 显示 TTL
 
 显示 TTL 的 SQL 语句如下所示:
 
diff --git a/docs/zh/UserGuide/Operate-Metadata/Template.md b/docs/zh/UserGuide/Operate-Metadata/Template.md
index a57edf3..e2e9076 100644
--- a/docs/zh/UserGuide/Operate-Metadata/Template.md
+++ b/docs/zh/UserGuide/Operate-Metadata/Template.md
@@ -19,42 +19,172 @@
 
 -->
 
-## 元数据模板
+# 元数据模板
 
 IoTDB 支持元数据模板功能,实现同类型不同实体的物理量元数据共享,减少元数据内存占用,同时简化同类型实体的管理。
 
-### 创建元数据模板
+注:以下语句中的 `schema` 关键字可以省略。
 
-创建元数据模板的 SQL 语句如下所示:
+## 创建元数据模板
 
+创建元数据模板的 SQL 语法如下:
+
+```sql
+CREATE SCHEMA? TEMPLATE <templateName> ALIGNED? '(' <measurementId> <attributeClauses> [',' <measurementId> <attributeClauses>]+ ')'
+```
+
+**示例1:** 创建包含两个非对齐序列的元数据模板
+
+```shell
+IoTDB> create schema template t1 (temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)
 ```
-IoTDB> create schema template temp1(GPS(lat FLOAT encoding=Gorilla, lon FLOAT encoding=Gorilla compression=SNAPPY), status BOOLEAN encoding=PLAIN compression=SNAPPY)
+
+**示例2:** 创建包含一组对齐序列的元数据模板
+
+```shell
+IoTDB> create schema template t2 aligned (lat FLOAT encoding=Gorilla, lon FLOAT encoding=Gorilla)
 ```
 
-其中,`GPS` 设备下的物理量 `lat` 和 `lon` 是对齐的。
+其中,物理量 `lat` 和 `lon` 是对齐的。
 
-### 挂载元数据模板
+## 挂载元数据模板
 
 挂载元数据模板的 SQL 语句如下所示:
 
-```
-IoTDB> set schema template temp1 to root.ln.wf01
+```shell
+IoTDB> set schema template t1 to root.sg1.d1
 ```
 
-挂载好元数据模板后,即可进行数据的写入。例如存储组为root.ln,模板temp1被挂载到了节点root.ln.wf01,那么可直接向时间序列(如root.ln.wf01.GPS.lat和root.ln.wf01.status)写入时间序列数据,该时间序列已可被当作正常创建的序列使用。
+挂载好元数据模板后,即可进行数据的写入。例如存储组为 root.sg1,模板 t1 被挂载到了节点 root.sg1.d1,那么可直接向时间序列(如 root.sg1.d1.temperature 和 root.sg1.d1.status)写入时间序列数据,该时间序列已可被当作正常创建的序列使用。
 
 **注意**:在插入数据之前,模板定义的时间序列不会被创建。可以使用如下SQL语句在插入数据前创建时间序列:
 
+```shell
+IoTDB> create timeseries of schema template on root.sg1.d1
 ```
-IoTDB> create timeseries of schema template on root.ln.wf01
+
+**示例:** 执行以下语句
+```shell
+set schema template t1 to root.sg1.d1
+set schema template t2 to root.sg1.d2
+create timeseries of schema template on root.sg1.d1
+create timeseries of schema template on root.sg1.d2
 ```
 
-### 卸载元数据模板
+查看此时的时间序列:
+```sql
+show timeseries root.sg1.**
+```
 
-卸载元数据模板的 SQL 语句如下所示:
+```shell
++-----------------------+-----+-------------+--------+--------+-----------+----+----------+
+|             timeseries|alias|storage group|dataType|encoding|compression|tags|attributes|
++-----------------------+-----+-------------+--------+--------+-----------+----+----------+
+|root.sg1.d1.temperature| null|     root.sg1|   FLOAT|     RLE|     SNAPPY|null|      null|
+|     root.sg1.d1.status| null|     root.sg1| BOOLEAN|   PLAIN|     SNAPPY|null|      null|
+|        root.sg1.d2.lon| null|     root.sg1|   FLOAT| GORILLA|     SNAPPY|null|      null|
+|        root.sg1.d2.lat| null|     root.sg1|   FLOAT| GORILLA|     SNAPPY|null|      null|
++-----------------------+-----+-------------+--------+--------+-----------+----+----------+
+```
 
+查看此时的设备:
+```sql
+show devices root.sg1.**
 ```
-IoTDB> unset schema template temp1 from root.beijing
+
+```shell
++---------------+---------+
+|        devices|isAligned|
++---------------+---------+
+|    root.sg1.d1|    false|
+|    root.sg1.d2|     true|
++---------------+---------+
+```
+
+## 查看元数据模板
+
+- 查看所有元数据模板
+
+SQL 语句如下所示:
+
+```shell
+IoTDB> show schema templates
+```
+
+执行结果如下:
+```shell
++-------------+
+|template name|
++-------------+
+|           t2|
+|           t1|
++-------------+
+```
+
+- 查看某个元数据模板下的物理量
+
+SQL 语句如下所示:
+
+```shell
+IoTDB> show nodes in schema template t1
+```
+
+执行结果如下:
+```shell
++-----------+--------+--------+-----------+
+|child nodes|dataType|encoding|compression|
++-----------+--------+--------+-----------+
+|temperature|   FLOAT|     RLE|     SNAPPY|
+|     status| BOOLEAN|   PLAIN|     SNAPPY|
++-----------+--------+--------+-----------+
+```
+
+- 查看挂载了某个元数据模板的路径前缀
+
+```shell
+IoTDB> show paths set schema template t1
+```
+
+执行结果如下:
+```shell
++-----------+
+|child paths|
++-----------+
+|root.sg1.d1|
++-----------+
+```
+
+- 查看使用了某个元数据模板(即序列已创建)的路径前缀
+
+```shell
+IoTDB> show paths using schema template t1
+```
+
+执行结果如下:
+```shell
++-----------+
+|child paths|
++-----------+
+|root.sg1.d1|
++-----------+
+```
+
+## 卸载元数据模板
+
+卸载元数据模板的 SQL 语句如下所示:
+
+```shell
+IoTDB> unset schema template t1 from root.sg1.d1
 ```
 
 **注意**:目前不支持从曾经使用模板插入数据后(即使数据已被删除)的实体中卸载模板。
+
+## 删除元数据模板
+
+删除元数据模板的 SQL 语句如下所示:
+
+```shell
+IoTDB> drop schema template t1
+```
+
+**注意**:不支持删除已经挂载的模板。
diff --git a/docs/zh/UserGuide/Operate-Metadata/Timeseries.md b/docs/zh/UserGuide/Operate-Metadata/Timeseries.md
index 28e74ca..af87aed 100644
--- a/docs/zh/UserGuide/Operate-Metadata/Timeseries.md
+++ b/docs/zh/UserGuide/Operate-Metadata/Timeseries.md
@@ -19,9 +19,9 @@
 
 -->
 
-## 时间序列管理
+# 时间序列管理
 
-### 创建时间序列
+## 创建时间序列
 
 根据建立的数据模型,我们可以分别在两个存储组中创建相应的时间序列。创建时间序列的 SQL 语句如下所示:
 
@@ -53,7 +53,7 @@ error: encoding TS_2DIFF does not support BOOLEAN
 
 详细的数据类型与编码方式的对应列表请参见 [编码方式](../Data-Concept/Encoding.md)。
 
-### 创建对齐时间序列 (v0.13 起支持)
+## 创建对齐时间序列
 
 创建一组对齐时间序列的SQL语句如下所示:
 
@@ -65,7 +65,7 @@ IoTDB> CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT encoding=PLAIN
 
 对齐的时间序列暂不支持设置别名、标签、属性。
 
-### 删除时间序列
+## 删除时间序列
 
 我们可以使用`DELETE TimeSeries <PathPattern>`语句来删除我们之前创建的时间序列。SQL 语句如下所示:
 
@@ -75,7 +75,7 @@ IoTDB> delete timeseries root.ln.wf01.wt01.temperature, root.ln.wf02.wt02.hardwa
 IoTDB> delete timeseries root.ln.wf02.*
 ```
 
-### 查看时间序列
+## 查看时间序列
 
 * SHOW LATEST? TIMESERIES pathPattern? whereClause? limitClause?
 
@@ -174,7 +174,7 @@ show timeseries root.ln.** limit 10 offset 10
   
 需要注意的是,当查询路径不存在时,系统会返回 0 条时间序列。
 
-### 统计时间序列总数
+## 统计时间序列总数
 
 IoTDB 支持使用`COUNT TIMESERIES<Path>`来统计一条路径中的时间序列个数。SQL 语句如下所示:
 ```
@@ -252,7 +252,7 @@ It costs 0.002s
 
 > 注意:时间序列的路径只是过滤条件,与 level 的定义无关。
 
-### 标签点管理
+## 标签点管理
 
 我们可以在创建时间序列的时候,为它添加别名和额外的标签和属性信息。
 所用到的扩展的创建时间序列的 SQL 语句如下所示:
diff --git a/docs/zh/UserGuide/Reference/Syntax-Conventions.md b/docs/zh/UserGuide/Reference/Syntax-Conventions.md
index ba01030..a0c7a53 100644
--- a/docs/zh/UserGuide/Reference/Syntax-Conventions.md
+++ b/docs/zh/UserGuide/Reference/Syntax-Conventions.md
@@ -19,11 +19,13 @@
 
 -->
 
-# 字面值常量
+# 语法约定
+
+## 字面值常量
 
 该部分对 IoTDB 中支持的字面值常量进行说明,包括字符串常量、数值型常量、时间戳常量、布尔型常量和空值。
 
-## 字符串常量
+### 字符串常量
 
 字符串是由单引号(`'`)或双引号(`"`)字符括起来的字符序列。示例如下:
 ```js
@@ -61,7 +63,7 @@
 "\"string"  // "string
 ```
 
-## 数值型常量
+### 数值型常量
 
 数值型常量包括整型和浮点型。
 
@@ -73,22 +75,22 @@
 
 在浮点上下文中可以使用整数,它会被解释为等效的浮点数。
 
-## 时间戳常量
+### 时间戳常量
 
 时间戳是一个数据到来的时间点,在 IoTDB 中分为绝对时间戳和相对时间戳。详细信息可参考 [数据类型文档](../Data-Concept/Data-Type.md)。
 
 特别地,`NOW()`表示语句开始执行时的服务端系统时间戳。
 
-## 布尔型常量
+### 布尔型常量
 
 布尔值常量 `TRUE` 和 `FALSE` 分别等价于 `1` 和 `0`,它们对大小写不敏感。
 
-## 空值
+### 空值
 
 `NULL`值表示没有数据。`NULL`对大小写不敏感。
 
 
-# 标识符
+## 标识符
 
 在 IoTDB 中,触发器名称、UDF函数名、元数据模板名称、用户与角色名等被称为标识符。
 
@@ -122,7 +124,7 @@ ab!  // 不合法,包含不被允许的特殊字符
 `a\`b`  // 合法,被解析为 a`b
 ```
 
-# 路径节点名
+## 路径节点名
 
 我们称一个路径中由 `.` 分割的部分叫做节点(node name)。
 
@@ -158,13 +160,13 @@ CREATE TIMESERIES root.a.b."s1.s2".c WITH DATATYPE=INT32, ENCODING=RLE
 // root.a.b."s1.s2".c 将被解析为 Path[root, a, b, "s1.s2", c]
 ```
 
-# 关键字和保留字
+## 关键字和保留字
 
 关键字是在 SQL 具有特定含义的词,不能直接用于标识符或路径节点名,需要使用反引号进行转义。保留字是关键字的一个子集,保留字不能用于标识符或路径节点名(即使进行了转义)。
 
 关于 IoTDB 的关键字和保留字列表,可以查看 [关键字和保留字](Keywords.md) 。
 
-# 表达式
+## 表达式
 
 IoTDB 支持在 `select` 子句中执行由数字常量、时间序列、算数运算表达式和时间序列生成函数(包括用户自定义函数)组成的任意嵌套表达式。
 
diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSchemaTemplateIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSchemaTemplateIT.java
index 01c0c1d..fd0856d 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSchemaTemplateIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSchemaTemplateIT.java
@@ -27,6 +27,9 @@ import org.junit.*;
 import org.junit.experimental.categories.Category;
 
 import java.sql.*;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
 
 /**
  * Notice that, all test begins with "IoTDB" is integration test. All test which will start the
@@ -45,6 +48,8 @@ public class IoTDBSchemaTemplateIT {
     Class.forName(Config.JDBC_DRIVER_NAME);
     connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
     statement = connection.createStatement();
+
+    prepareTemplate();
   }
 
   @After
@@ -56,22 +61,25 @@ public class IoTDBSchemaTemplateIT {
 
   @Test
   public void testCreateTemplateAndCreateTimeseries() throws SQLException {
-    statement.execute("CREATE STORAGE GROUP root.sg1");
-
-    // create schema template
-    statement.execute(
-        "CREATE SCHEMA TEMPLATE temp1 (s1 INT64 encoding=RLE compressor=SNAPPY, vector1(s1 FLOAT, s2 INT64))");
-
     // test create schema template repeatedly
     try {
       statement.execute(
-          "CREATE SCHEMA TEMPLATE temp1 (s1 INT64 encoding=RLE compressor=SNAPPY, vector1(s1 FLOAT, s2 INT64))");
+          "CREATE SCHEMA TEMPLATE t1 (s1 INT64 encoding=RLE compressor=SNAPPY, s2 INT32)");
     } catch (IoTDBSQLException e) {
-      Assert.assertEquals("303: Duplicated template name: temp1", e.getMessage());
+      Assert.assertEquals("303: Duplicated template name: t1", e.getMessage());
     }
 
     // set schema template
-    statement.execute("SET SCHEMA TEMPLATE temp1 TO root.sg1.d1");
+    statement.execute("SET SCHEMA TEMPLATE t1 TO root.sg1.d1");
+    statement.execute("SET SCHEMA TEMPLATE t2 TO root.sg1.d2");
+
+    // test drop template which has been set
+    try {
+      statement.execute("DROP SCHEMA TEMPLATE t1");
+    } catch (IoTDBSQLException e) {
+      Assert.assertEquals(
+          "303: Template [t1] has been set on MTree, cannot be dropped now.", e.getMessage());
+    }
 
     statement.execute("SHOW TIMESERIES root.sg1.**");
     try (ResultSet resultSet = statement.getResultSet()) {
@@ -80,21 +88,22 @@ public class IoTDBSchemaTemplateIT {
 
     // create timeseries of schema template
     statement.execute("CREATE TIMESERIES OF SCHEMA TEMPLATE ON root.sg1.d1");
+    statement.execute("CREATE TIMESERIES OF SCHEMA TEMPLATE ON root.sg1.d2");
 
     boolean hasResult = statement.execute("SHOW TIMESERIES root.sg1.**");
     Assert.assertTrue(hasResult);
 
-    String[] expectedResult =
-        new String[] {
-          "root.sg1.d1.vector1.s1,FLOAT,GORILLA,SNAPPY",
-          "root.sg1.d1.vector1.s2,INT64,RLE,SNAPPY",
-          "root.sg1.d1.s1,INT64,RLE,SNAPPY"
-        };
+    Set<String> expectedResult =
+        new HashSet<>(
+            Arrays.asList(
+                "root.sg1.d1.s1,INT64,RLE,SNAPPY",
+                "root.sg1.d1.s2,DOUBLE,GORILLA,SNAPPY",
+                "root.sg1.d2.s1,INT64,RLE,SNAPPY",
+                "root.sg1.d2.s2,DOUBLE,GORILLA,SNAPPY"));
 
-    int count = 0;
     try (ResultSet resultSet = statement.getResultSet()) {
       while (resultSet.next()) {
-        String ActualResult =
+        String actualResult =
             resultSet.getString("timeseries")
                 + ","
                 + resultSet.getString("dataType")
@@ -102,30 +111,29 @@ public class IoTDBSchemaTemplateIT {
                 + resultSet.getString("encoding")
                 + ","
                 + resultSet.getString("compression");
-        Assert.assertEquals(expectedResult[count], ActualResult);
-        count++;
+        Assert.assertTrue(expectedResult.contains(actualResult));
+        expectedResult.remove(actualResult);
       }
     }
-    Assert.assertEquals(3, count);
+    Assert.assertTrue(expectedResult.isEmpty());
 
     hasResult = statement.execute("SHOW DEVICES");
     Assert.assertTrue(hasResult);
 
-    expectedResult = new String[] {"root.sg1.d1,false", "root.sg1.d1.vector1,true"};
+    expectedResult = new HashSet<>(Arrays.asList("root.sg1.d1,false", "root.sg1.d2,true"));
 
-    count = 0;
     try (ResultSet resultSet = statement.getResultSet()) {
       while (resultSet.next()) {
-        String ActualResult =
+        String actualResult =
             resultSet.getString("devices") + "," + resultSet.getString("isAligned");
-        Assert.assertEquals(expectedResult[count], ActualResult);
-        count++;
+        Assert.assertTrue(expectedResult.contains(actualResult));
+        expectedResult.remove(actualResult);
       }
     }
-    Assert.assertEquals(2, count);
+    Assert.assertTrue(expectedResult.isEmpty());
 
     try {
-      statement.execute("UNSET SCHEMA TEMPLATE temp1 FROM root.sg1.d1");
+      statement.execute("UNSET SCHEMA TEMPLATE t1 FROM root.sg1.d1");
     } catch (IoTDBSQLException e) {
       Assert.assertEquals("326: Template is in use on root.sg1.d1", e.getMessage());
     }
@@ -133,22 +141,17 @@ public class IoTDBSchemaTemplateIT {
 
   @Test
   public void testCreateAndSetSchemaTemplate() throws SQLException {
-    statement.execute("CREATE STORAGE GROUP root.sg1");
-
-    // create schema template
-    statement.execute(
-        "CREATE SCHEMA TEMPLATE temp1 (s1 INT64 encoding=RLE compressor=SNAPPY, vector1(s1 FLOAT, s2 INT64))");
-
     // test create schema template repeatedly
     try {
       statement.execute(
-          "CREATE SCHEMA TEMPLATE temp1 (s1 INT64 encoding=RLE compressor=SNAPPY, vector1(s1 FLOAT, s2 INT64))");
+          "CREATE SCHEMA TEMPLATE t1 (s1 INT64 encoding=RLE compressor=SNAPPY, s2 INT32)");
     } catch (IoTDBSQLException e) {
-      Assert.assertEquals("303: Duplicated template name: temp1", e.getMessage());
+      Assert.assertEquals("303: Duplicated template name: t1", e.getMessage());
     }
 
     // set schema template
-    statement.execute("SET SCHEMA TEMPLATE temp1 TO root.sg1.d1");
+    statement.execute("SET SCHEMA TEMPLATE t1 TO root.sg1.d1");
+    statement.execute("SET SCHEMA TEMPLATE t2 TO root.sg1.d2");
 
     statement.execute("SHOW TIMESERIES root.sg1.**");
     try (ResultSet resultSet = statement.getResultSet()) {
@@ -157,21 +160,22 @@ public class IoTDBSchemaTemplateIT {
 
     // set using schema template
     statement.execute("INSERT INTO root.sg1.d1(time,s1) VALUES (1,1)");
+    statement.execute("INSERT INTO root.sg1.d2(time,s1) ALIGNED VALUES (1,1)");
 
     boolean hasResult = statement.execute("SHOW TIMESERIES root.sg1.**");
     Assert.assertTrue(hasResult);
 
-    String[] expectedResult =
-        new String[] {
-          "root.sg1.d1.vector1.s1,FLOAT,GORILLA,SNAPPY",
-          "root.sg1.d1.vector1.s2,INT64,RLE,SNAPPY",
-          "root.sg1.d1.s1,INT64,RLE,SNAPPY"
-        };
+    Set<String> expectedResult =
+        new HashSet<>(
+            Arrays.asList(
+                "root.sg1.d1.s1,INT64,RLE,SNAPPY",
+                "root.sg1.d1.s2,DOUBLE,GORILLA,SNAPPY",
+                "root.sg1.d2.s1,INT64,RLE,SNAPPY",
+                "root.sg1.d2.s2,DOUBLE,GORILLA,SNAPPY"));
 
-    int count = 0;
     try (ResultSet resultSet = statement.getResultSet()) {
       while (resultSet.next()) {
-        String ActualResult =
+        String actualResult =
             resultSet.getString("timeseries")
                 + ","
                 + resultSet.getString("dataType")
@@ -179,32 +183,147 @@ public class IoTDBSchemaTemplateIT {
                 + resultSet.getString("encoding")
                 + ","
                 + resultSet.getString("compression");
-        Assert.assertEquals(expectedResult[count], ActualResult);
-        count++;
+        Assert.assertTrue(expectedResult.contains(actualResult));
+        expectedResult.remove(actualResult);
       }
     }
-    Assert.assertEquals(3, count);
+    Assert.assertTrue(expectedResult.isEmpty());
 
     hasResult = statement.execute("SHOW DEVICES");
     Assert.assertTrue(hasResult);
 
-    expectedResult = new String[] {"root.sg1.d1,false", "root.sg1.d1.vector1,true"};
+    expectedResult = new HashSet<>(Arrays.asList("root.sg1.d1,false", "root.sg1.d2,true"));
 
-    count = 0;
     try (ResultSet resultSet = statement.getResultSet()) {
       while (resultSet.next()) {
-        String ActualResult =
+        String actualResult =
             resultSet.getString("devices") + "," + resultSet.getString("isAligned");
-        Assert.assertEquals(expectedResult[count], ActualResult);
-        count++;
+        Assert.assertTrue(expectedResult.contains(actualResult));
+        expectedResult.remove(actualResult);
       }
     }
-    Assert.assertEquals(2, count);
+    Assert.assertTrue(expectedResult.isEmpty());
 
     try {
-      statement.execute("UNSET SCHEMA TEMPLATE temp1 FROM root.sg1.d1");
+      statement.execute("UNSET SCHEMA TEMPLATE t1 FROM root.sg1.d1");
     } catch (IoTDBSQLException e) {
       Assert.assertEquals("326: Template is in use on root.sg1.d1", e.getMessage());
     }
   }
+
+  @Test
+  public void testDropAndShowSchemaTemplates() throws SQLException {
+    // show schema templates
+    statement.execute("SHOW SCHEMA TEMPLATES");
+    String[] expectedResult = new String[] {"t1", "t2"};
+    Set<String> expectedResultSet = new HashSet<>(Arrays.asList(expectedResult));
+    try (ResultSet resultSet = statement.getResultSet()) {
+      while (resultSet.next()) {
+        Assert.assertTrue(expectedResultSet.contains(resultSet.getString("template name")));
+        expectedResultSet.remove(resultSet.getString("template name"));
+      }
+    }
+    Assert.assertEquals(0, expectedResultSet.size());
+
+    // drop schema template
+    statement.execute("DROP SCHEMA TEMPLATE t2");
+    statement.execute("SHOW SCHEMA TEMPLATES");
+    expectedResult = new String[] {"t1"};
+    expectedResultSet = new HashSet<>(Arrays.asList(expectedResult));
+    try (ResultSet resultSet = statement.getResultSet()) {
+      while (resultSet.next()) {
+        Assert.assertTrue(expectedResultSet.contains(resultSet.getString("template name")));
+        expectedResultSet.remove(resultSet.getString("template name"));
+      }
+    }
+    Assert.assertEquals(0, expectedResultSet.size());
+  }
+
+  @Test
+  public void testShowNodesInSchemaTemplate() throws SQLException {
+    // set schema template
+    statement.execute("SHOW NODES IN SCHEMA TEMPLATE t1");
+    Set<String> expectedResultSet =
+        new HashSet<>(Arrays.asList("s1,INT64,RLE,SNAPPY", "s2,DOUBLE,GORILLA,SNAPPY"));
+    try (ResultSet resultSet = statement.getResultSet()) {
+      while (resultSet.next()) {
+        String actualResult =
+            resultSet.getString("child nodes")
+                + ","
+                + resultSet.getString("dataType")
+                + ","
+                + resultSet.getString("encoding")
+                + ","
+                + resultSet.getString("compression");
+        Assert.assertTrue(expectedResultSet.contains(actualResult));
+        expectedResultSet.remove(actualResult);
+      }
+    }
+    Assert.assertEquals(0, expectedResultSet.size());
+  }
+
+  @Test
+  public void testShowPathsSetOrUsingSchemaTemplate() throws SQLException {
+    // set schema template
+    statement.execute("SET SCHEMA TEMPLATE t1 TO root.sg1.d1");
+    statement.execute("SET SCHEMA TEMPLATE t1 TO root.sg1.d2");
+    statement.execute("SET SCHEMA TEMPLATE t1 TO root.sg2.d1");
+    statement.execute("SET SCHEMA TEMPLATE t1 TO root.sg2.d2");
+    statement.execute("SET SCHEMA TEMPLATE t2 TO root.sg3.d1");
+    statement.execute("SET SCHEMA TEMPLATE t2 TO root.sg3.d2");
+
+    // activate schema template
+    statement.execute("CREATE TIMESERIES OF SCHEMA TEMPLATE ON root.sg1.d2");
+    statement.execute("CREATE TIMESERIES OF SCHEMA TEMPLATE ON root.sg2.d1");
+
+    // show paths set schema template
+    statement.execute("SHOW PATHS SET SCHEMA TEMPLATE t1");
+    String[] expectedResult =
+        new String[] {"root.sg1.d1", "root.sg2.d2", "root.sg1.d2", "root.sg2.d1"};
+    Set<String> expectedResultSet = new HashSet<>(Arrays.asList(expectedResult));
+    try (ResultSet resultSet = statement.getResultSet()) {
+      while (resultSet.next()) {
+        Assert.assertTrue(expectedResultSet.contains(resultSet.getString("child paths")));
+        expectedResultSet.remove(resultSet.getString("child paths"));
+      }
+    }
+    Assert.assertEquals(0, expectedResultSet.size());
+
+    statement.execute("SHOW PATHS SET SCHEMA TEMPLATE t2");
+    expectedResult = new String[] {"root.sg3.d1", "root.sg3.d2"};
+    expectedResultSet = new HashSet<>(Arrays.asList(expectedResult));
+    try (ResultSet resultSet = statement.getResultSet()) {
+      while (resultSet.next()) {
+        Assert.assertTrue(expectedResultSet.contains(resultSet.getString("child paths")));
+        expectedResultSet.remove(resultSet.getString("child paths"));
+      }
+    }
+    Assert.assertEquals(0, expectedResultSet.size());
+
+    statement.execute("SHOW PATHS USING SCHEMA TEMPLATE t1");
+    expectedResult = new String[] {"root.sg1.d2", "root.sg2.d1"};
+    expectedResultSet = new HashSet<>(Arrays.asList(expectedResult));
+    try (ResultSet resultSet = statement.getResultSet()) {
+      while (resultSet.next()) {
+        Assert.assertTrue(expectedResultSet.contains(resultSet.getString("child paths")));
+        expectedResultSet.remove(resultSet.getString("child paths"));
+      }
+    }
+    Assert.assertEquals(0, expectedResultSet.size());
+
+    statement.execute("SHOW PATHS USING SCHEMA TEMPLATE t2");
+    ResultSet resultSet = statement.getResultSet();
+    Assert.assertFalse(resultSet.next());
+  }
+
+  private void prepareTemplate() throws SQLException {
+    // create storage group
+    statement.execute("CREATE STORAGE GROUP root.sg1");
+    statement.execute("CREATE STORAGE GROUP root.sg2");
+    statement.execute("CREATE STORAGE GROUP root.sg3");
+
+    // create schema template
+    statement.execute("CREATE SCHEMA TEMPLATE t1 (s1 INT64, s2 DOUBLE)");
+    statement.execute("CREATE SCHEMA TEMPLATE t2 aligned (s1 INT64, s2 DOUBLE)");
+  }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java
index 67b0dd5..b98c674 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConstant.java
@@ -107,6 +107,8 @@ public class IoTDBConstant {
   public static final String COLUMN_CONTINUOUS_QUERY_TARGET_PATH = "target path";
   public static final String COLUMN_CONTINUOUS_QUERY_QUERY_SQL = "query sql";
 
+  public static final String COLUMN_SCHEMA_TEMPLATE = "template name";
+
   public static final String FUNCTION_TYPE_NATIVE = "native";
   public static final String FUNCTION_TYPE_BUILTIN_UDAF = "built-in UDAF";
   public static final String FUNCTION_TYPE_BUILTIN_UDTF = "built-in UDTF";
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java b/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
index 2bbac26..a0b3168 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
@@ -189,8 +189,15 @@ public class SQLConstant {
   public static final int TOK_SCHEMA_TEMPLATE_SET = 113;
   public static final int TOK_SCHEMA_TEMPLATE_ACTIVATE = 114;
   public static final int TOK_SCHEMA_TEMPLATE_UNSET = 115;
+  public static final int TOK_SCHEMA_TEMPLATE_APPEND = 116;
+  public static final int TOK_SCHEMA_TEMPLATE_PRUNE = 117;
+  public static final int TOK_SCHEMA_TEMPLATE_DROP = 118;
+  public static final int TOK_SCHEMA_TEMPLATE_SHOW = 119;
+  public static final int TOK_SCHEMA_TEMPLATE_SHOW_NODES = 120;
+  public static final int TOK_SCHEMA_TEMPLATE_SHOW_PATHS_SET = 121;
+  public static final int TOK_SCHEMA_TEMPLATE_SHOW_PATHS_USING = 122;
 
-  public static final int TOK_SHOW_QUERY_RESOURCE = 116;
+  public static final int TOK_SHOW_QUERY_RESOURCE = 123;
 
   public static final Map<Integer, String> tokenNames = new HashMap<>();
 
@@ -269,6 +276,13 @@ public class SQLConstant {
     tokenNames.put(TOK_SCHEMA_TEMPLATE_SET, "TOK_SCHEMA_TEMPLATE_SET");
     tokenNames.put(TOK_SCHEMA_TEMPLATE_ACTIVATE, "TOK_SCHEMA_TEMPLATE_ACTIVATE");
     tokenNames.put(TOK_SCHEMA_TEMPLATE_UNSET, "TOK_SCHEMA_TEMPLATE_UNSET");
+    tokenNames.put(TOK_SCHEMA_TEMPLATE_APPEND, "TOK_SCHEMA_TEMPLATE_APPEND");
+    tokenNames.put(TOK_SCHEMA_TEMPLATE_PRUNE, "TOK_SCHEMA_TEMPLATE_PRUNE");
+    tokenNames.put(TOK_SCHEMA_TEMPLATE_DROP, "TOK_SCHEMA_TEMPLATE_DROP");
+    tokenNames.put(TOK_SCHEMA_TEMPLATE_SHOW, "TOK_SCHEMA_TEMPLATE_SHOW");
+    tokenNames.put(TOK_SCHEMA_TEMPLATE_SHOW_NODES, "TOK_SCHEMA_TEMPLATE_SHOW_NODES");
+    tokenNames.put(TOK_SCHEMA_TEMPLATE_SHOW_PATHS_SET, "TOK_SCHEMA_TEMPLATE_SHOW_PATHS_SET");
+    tokenNames.put(TOK_SCHEMA_TEMPLATE_SHOW_PATHS_USING, "TOK_SCHEMA_TEMPLATE_SHOW_PATHS_USING");
 
     tokenNames.put(TOK_SHOW_QUERY_RESOURCE, "TOK_SHOW_QUERY_RESOURCE");
   }
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
index 9d87034..9540444 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
@@ -79,6 +79,7 @@ import org.apache.iotdb.db.qp.physical.crud.QueryPlan;
 import org.apache.iotdb.db.qp.physical.crud.RawDataQueryPlan;
 import org.apache.iotdb.db.qp.physical.crud.UDAFPlan;
 import org.apache.iotdb.db.qp.physical.crud.UDTFPlan;
+import org.apache.iotdb.db.qp.physical.sys.*;
 import org.apache.iotdb.db.qp.physical.sys.ActivateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.AlterTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.AppendTemplatePlan;
@@ -184,37 +185,7 @@ import java.util.Set;
 import java.util.concurrent.Future;
 import java.util.concurrent.ThreadPoolExecutor;
 
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_CHILD_NODES;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_CHILD_PATHS;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_COLUMN;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_CONTINUOUS_QUERY_BOUNDARY;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_CONTINUOUS_QUERY_EVERY_INTERVAL;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_CONTINUOUS_QUERY_FOR_INTERVAL;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_CONTINUOUS_QUERY_NAME;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_CONTINUOUS_QUERY_QUERY_SQL;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_CONTINUOUS_QUERY_TARGET_PATH;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_COUNT;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_DEVICES;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_FUNCTION_CLASS;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_FUNCTION_NAME;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_FUNCTION_TYPE;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_ITEM;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_LOCK_INFO;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_PRIVILEGE;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_ROLE;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_STORAGE_GROUP;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_TTL;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_USER;
-import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_VALUE;
-import static org.apache.iotdb.db.conf.IoTDBConstant.FILE_NAME_SEPARATOR;
-import static org.apache.iotdb.db.conf.IoTDBConstant.FUNCTION_TYPE_BUILTIN_UDAF;
-import static org.apache.iotdb.db.conf.IoTDBConstant.FUNCTION_TYPE_BUILTIN_UDTF;
-import static org.apache.iotdb.db.conf.IoTDBConstant.FUNCTION_TYPE_EXTERNAL_UDAF;
-import static org.apache.iotdb.db.conf.IoTDBConstant.FUNCTION_TYPE_EXTERNAL_UDTF;
-import static org.apache.iotdb.db.conf.IoTDBConstant.FUNCTION_TYPE_NATIVE;
-import static org.apache.iotdb.db.conf.IoTDBConstant.MULTI_LEVEL_PATH_WILDCARD;
-import static org.apache.iotdb.db.conf.IoTDBConstant.QUERY_ID;
-import static org.apache.iotdb.db.conf.IoTDBConstant.STATEMENT;
+import static org.apache.iotdb.db.conf.IoTDBConstant.*;
 import static org.apache.iotdb.rpc.TSStatusCode.INTERNAL_SERVER_ERROR;
 import static org.apache.iotdb.tsfile.common.constant.TsFileConstant.TSFILE_SUFFIX;
 
@@ -680,6 +651,14 @@ public class PlanExecutor implements IPlanExecutor {
         return processShowTriggers();
       case CONTINUOUS_QUERY:
         return processShowContinuousQueries();
+      case SCHEMA_TEMPLATE:
+        return processShowSchemaTemplates();
+      case NODES_IN_SCHEMA_TEMPLATE:
+        return processShowNodesInSchemaTemplate((ShowNodesInTemplatePlan) showPlan);
+      case PATHS_SET_SCHEMA_TEMPLATE:
+        return processShowPathsSetSchemaTemplate((ShowPathsSetTemplatePlan) showPlan);
+      case PATHS_USING_SCHEMA_TEMPLATE:
+        return processShowPathsUsingSchemaTemplate((ShowPathsUsingTemplatePlan) showPlan);
       default:
         throw new QueryProcessException(String.format("Unrecognized show plan %s", showPlan));
     }
@@ -1072,6 +1051,89 @@ public class PlanExecutor implements IPlanExecutor {
     return listDataSet;
   }
 
+  private QueryDataSet processShowSchemaTemplates() {
+    ListDataSet listDataSet =
+        new ListDataSet(
+            Collections.singletonList(new PartialPath(COLUMN_SCHEMA_TEMPLATE, false)),
+            Collections.singletonList(TSDataType.TEXT));
+    Set<String> allTemplates = IoTDB.metaManager.getAllTemplates();
+    for (String templateName : allTemplates) {
+      RowRecord rowRecord = new RowRecord(0); // ignore timestamp
+      rowRecord.addField(Binary.valueOf(templateName), TSDataType.TEXT);
+      listDataSet.putRecord(rowRecord);
+    }
+    return listDataSet;
+  }
+
+  private QueryDataSet processShowNodesInSchemaTemplate(ShowNodesInTemplatePlan showPlan)
+      throws QueryProcessException {
+    ListDataSet listDataSet =
+        new ListDataSet(
+            Arrays.asList(
+                new PartialPath(COLUMN_CHILD_NODES, false),
+                new PartialPath(COLUMN_TIMESERIES_DATATYPE, false),
+                new PartialPath(COLUMN_TIMESERIES_ENCODING, false),
+                new PartialPath(COLUMN_TIMESERIES_COMPRESSION, false)),
+            Arrays.asList(TSDataType.TEXT, TSDataType.TEXT, TSDataType.TEXT, TSDataType.TEXT));
+    try {
+      List<Pair<String, IMeasurementSchema>> measurements =
+          IoTDB.metaManager.getSchemasInTemplate(showPlan.getTemplateName(), "");
+      for (Pair<String, IMeasurementSchema> measurement : measurements) {
+        RowRecord rowRecord = new RowRecord(0); // ignore timestamp
+        rowRecord.addField(Binary.valueOf(measurement.left), TSDataType.TEXT);
+
+        IMeasurementSchema measurementSchema = measurement.right;
+        rowRecord.addField(Binary.valueOf(measurementSchema.getType().toString()), TSDataType.TEXT);
+        rowRecord.addField(
+            Binary.valueOf(measurementSchema.getEncodingType().toString()), TSDataType.TEXT);
+        rowRecord.addField(
+            Binary.valueOf(measurementSchema.getCompressor().toString()), TSDataType.TEXT);
+        listDataSet.putRecord(rowRecord);
+      }
+    } catch (MetadataException e) {
+      throw new QueryProcessException(e);
+    }
+    return listDataSet;
+  }
+
+  private QueryDataSet processShowPathsUsingSchemaTemplate(ShowPathsUsingTemplatePlan showPlan)
+      throws QueryProcessException {
+    ListDataSet listDataSet =
+        new ListDataSet(
+            Collections.singletonList(new PartialPath(COLUMN_CHILD_PATHS, false)),
+            Collections.singletonList(TSDataType.TEXT));
+    try {
+      Set<String> paths = IoTDB.metaManager.getPathsUsingTemplate(showPlan.getTemplateName());
+      for (String path : paths) {
+        RowRecord rowRecord = new RowRecord(0); // ignore timestamp
+        rowRecord.addField(Binary.valueOf(path), TSDataType.TEXT);
+        listDataSet.putRecord(rowRecord);
+      }
+    } catch (MetadataException e) {
+      throw new QueryProcessException(e);
+    }
+    return listDataSet;
+  }
+
+  private QueryDataSet processShowPathsSetSchemaTemplate(ShowPathsSetTemplatePlan showPlan)
+      throws QueryProcessException {
+    ListDataSet listDataSet =
+        new ListDataSet(
+            Collections.singletonList(new PartialPath(COLUMN_CHILD_PATHS, false)),
+            Collections.singletonList(TSDataType.TEXT));
+    try {
+      Set<String> paths = IoTDB.metaManager.getPathsSetTemplate(showPlan.getTemplateName());
+      for (String path : paths) {
+        RowRecord rowRecord = new RowRecord(0); // ignore timestamp
+        rowRecord.addField(Binary.valueOf(path), TSDataType.TEXT);
+        listDataSet.putRecord(rowRecord);
+      }
+    } catch (MetadataException e) {
+      throw new QueryProcessException(e);
+    }
+    return listDataSet;
+  }
+
   private void appendNativeFunctions(ListDataSet listDataSet, ShowFunctionsPlan showPlan) {
     final Binary functionType = Binary.valueOf(FUNCTION_TYPE_NATIVE);
     final Binary className = Binary.valueOf("");
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/DropTemplateOperator.java
similarity index 50%
copy from server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowOperator.java
copy to server/src/main/java/org/apache/iotdb/db/qp/logical/sys/DropTemplateOperator.java
index 689c13b..026a641 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowOperator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/DropTemplateOperator.java
@@ -15,47 +15,35 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
  */
 package org.apache.iotdb.db.qp.logical.sys;
 
-import org.apache.iotdb.db.exception.query.LogicalOperatorException;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.qp.constant.SQLConstant;
 import org.apache.iotdb.db.qp.logical.Operator;
 import org.apache.iotdb.db.qp.physical.PhysicalPlan;
-import org.apache.iotdb.db.qp.physical.sys.ShowContinuousQueriesPlan;
-import org.apache.iotdb.db.qp.physical.sys.ShowPlan;
-import org.apache.iotdb.db.qp.physical.sys.ShowPlan.ShowContentType;
-import org.apache.iotdb.db.qp.physical.sys.ShowQueryProcesslistPlan;
+import org.apache.iotdb.db.qp.physical.sys.DropTemplatePlan;
 import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
 
-public class ShowOperator extends Operator {
+public class DropTemplateOperator extends Operator {
 
-  public ShowOperator(int tokenIntType) {
-    this(tokenIntType, OperatorType.SHOW);
-  }
+  private String templateName;
 
-  public ShowOperator(int tokenIntType, OperatorType operatorType) {
+  public DropTemplateOperator(int tokenIntType) {
     super(tokenIntType);
-    this.operatorType = operatorType;
+    operatorType = OperatorType.DROP_TEMPLATE;
+  }
+
+  public String getTemplateName() {
+    return templateName;
+  }
+
+  public void setTemplateName(String templateName) {
+    this.templateName = templateName;
   }
 
   @Override
   public PhysicalPlan generatePhysicalPlan(PhysicalGenerator generator)
       throws QueryProcessException {
-    switch (tokenIntType) {
-      case SQLConstant.TOK_FLUSH_TASK_INFO:
-        return new ShowPlan(ShowContentType.FLUSH_TASK_INFO);
-      case SQLConstant.TOK_VERSION:
-        return new ShowPlan(ShowContentType.VERSION);
-      case SQLConstant.TOK_QUERY_PROCESSLIST:
-        return new ShowQueryProcesslistPlan(ShowContentType.QUERY_PROCESSLIST);
-      case SQLConstant.TOK_SHOW_CONTINUOUS_QUERIES:
-        return new ShowContinuousQueriesPlan();
-      default:
-        throw new LogicalOperatorException(
-            String.format("not supported operator type %s in show operation.", operatorType));
-    }
+    return new DropTemplatePlan(templateName);
   }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowNodesInTemplateOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowNodesInTemplateOperator.java
new file mode 100644
index 0000000..72c3555
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowNodesInTemplateOperator.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.iotdb.db.qp.logical.sys;
+
+import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.qp.physical.PhysicalPlan;
+import org.apache.iotdb.db.qp.physical.sys.ShowNodesInTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.ShowPlan;
+import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
+
+public class ShowNodesInTemplateOperator extends ShowOperator {
+
+  private String templateName;
+
+  public ShowNodesInTemplateOperator(int tokeIntType, String templateName) {
+    super(tokeIntType);
+    this.templateName = templateName;
+  }
+
+  @Override
+  public PhysicalPlan generatePhysicalPlan(PhysicalGenerator generator)
+      throws QueryProcessException {
+    return new ShowNodesInTemplatePlan(
+        ShowPlan.ShowContentType.NODES_IN_SCHEMA_TEMPLATE, templateName);
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowOperator.java
index 689c13b..360b371 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowOperator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowOperator.java
@@ -28,6 +28,7 @@ import org.apache.iotdb.db.qp.physical.sys.ShowContinuousQueriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowPlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowPlan.ShowContentType;
 import org.apache.iotdb.db.qp.physical.sys.ShowQueryProcesslistPlan;
+import org.apache.iotdb.db.qp.physical.sys.ShowTemplatesPlan;
 import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
 
 public class ShowOperator extends Operator {
@@ -53,6 +54,8 @@ public class ShowOperator extends Operator {
         return new ShowQueryProcesslistPlan(ShowContentType.QUERY_PROCESSLIST);
       case SQLConstant.TOK_SHOW_CONTINUOUS_QUERIES:
         return new ShowContinuousQueriesPlan();
+      case SQLConstant.TOK_SCHEMA_TEMPLATE_SHOW:
+        return new ShowTemplatesPlan();
       default:
         throw new LogicalOperatorException(
             String.format("not supported operator type %s in show operation.", operatorType));
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowPathsSetTemplateOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowPathsSetTemplateOperator.java
new file mode 100644
index 0000000..3597a85
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowPathsSetTemplateOperator.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.iotdb.db.qp.logical.sys;
+
+import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.qp.physical.PhysicalPlan;
+import org.apache.iotdb.db.qp.physical.sys.ShowPathsSetTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.ShowPlan;
+import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
+
+public class ShowPathsSetTemplateOperator extends ShowOperator {
+
+  private String templateName;
+
+  public ShowPathsSetTemplateOperator(int tokeIntType, String templateName) {
+    super(tokeIntType);
+    this.templateName = templateName;
+  }
+
+  @Override
+  public PhysicalPlan generatePhysicalPlan(PhysicalGenerator generator)
+      throws QueryProcessException {
+    return new ShowPathsSetTemplatePlan(
+        ShowPlan.ShowContentType.PATHS_SET_SCHEMA_TEMPLATE, templateName);
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowPathsUsingTemplateOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowPathsUsingTemplateOperator.java
new file mode 100644
index 0000000..fef601f
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowPathsUsingTemplateOperator.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.iotdb.db.qp.logical.sys;
+
+import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.qp.physical.PhysicalPlan;
+import org.apache.iotdb.db.qp.physical.sys.ShowPathsUsingTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.ShowPlan;
+import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
+
+public class ShowPathsUsingTemplateOperator extends ShowOperator {
+
+  private String templateName;
+
+  public ShowPathsUsingTemplateOperator(int tokeIntType, String templateName) {
+    super(tokeIntType);
+    this.templateName = templateName;
+  }
+
+  @Override
+  public PhysicalPlan generatePhysicalPlan(PhysicalGenerator generator)
+      throws QueryProcessException {
+    return new ShowPathsUsingTemplatePlan(
+        ShowPlan.ShowContentType.PATHS_USING_SCHEMA_TEMPLATE, templateName);
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowTemplatesOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowTemplatesOperator.java
new file mode 100644
index 0000000..015c591
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ShowTemplatesOperator.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.iotdb.db.qp.logical.sys;
+
+public class ShowTemplatesOperator extends ShowOperator {
+
+  public ShowTemplatesOperator(int tokeIntType) {
+    super(tokeIntType);
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowNodesInTemplatePlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowNodesInTemplatePlan.java
new file mode 100644
index 0000000..7266515
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowNodesInTemplatePlan.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.qp.physical.sys;
+
+public class ShowNodesInTemplatePlan extends ShowPlan {
+
+  private String templateName;
+
+  public ShowNodesInTemplatePlan(ShowContentType showContentType, String templateName) {
+    super(showContentType);
+    this.templateName = templateName;
+  }
+
+  public String getTemplateName() {
+    return templateName;
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPathsSetTemplatePlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPathsSetTemplatePlan.java
new file mode 100644
index 0000000..9368de3
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPathsSetTemplatePlan.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.qp.physical.sys;
+
+public class ShowPathsSetTemplatePlan extends ShowPlan {
+
+  private String templateName;
+
+  public ShowPathsSetTemplatePlan(ShowContentType showContentType, String templateName) {
+    super(showContentType);
+    this.templateName = templateName;
+  }
+
+  public String getTemplateName() {
+    return templateName;
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPathsUsingTemplatePlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPathsUsingTemplatePlan.java
new file mode 100644
index 0000000..c8e021b
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPathsUsingTemplatePlan.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.qp.physical.sys;
+
+public class ShowPathsUsingTemplatePlan extends ShowPlan {
+
+  private String templateName;
+
+  public ShowPathsUsingTemplatePlan(ShowContentType showContentType, String templateName) {
+    super(showContentType);
+    this.templateName = templateName;
+  }
+
+  public String getTemplateName() {
+    return templateName;
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPlan.java
index ed3e4f4..8cf7337 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPlan.java
@@ -122,6 +122,10 @@ public class ShowPlan extends PhysicalPlan {
     TRIGGERS,
     LOCK_INFO,
     CONTINUOUS_QUERY,
-    QUERY_RESOURCE
+    QUERY_RESOURCE,
+    SCHEMA_TEMPLATE,
+    NODES_IN_SCHEMA_TEMPLATE,
+    PATHS_SET_SCHEMA_TEMPLATE,
+    PATHS_USING_SCHEMA_TEMPLATE
   }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowTemplatesPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowTemplatesPlan.java
new file mode 100644
index 0000000..27f93dd
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowTemplatesPlan.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.qp.physical.sys;
+
+public class ShowTemplatesPlan extends ShowPlan {
+
+  public ShowTemplatesPlan() {
+    super(ShowContentType.SCHEMA_TEMPLATE);
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java b/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
index 113e2f4..97a0158 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
@@ -311,9 +311,29 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     CreateTemplateOperator createTemplateOperator =
         new CreateTemplateOperator(SQLConstant.TOK_SCHEMA_TEMPLATE_CREATE);
     createTemplateOperator.setName(ctx.templateName.getText());
-    for (IoTDBSqlParser.TemplateMeasurementClauseContext templateClauseContext :
-        ctx.templateMeasurementClause()) {
-      parseTemplateMeasurementClause(templateClauseContext, createTemplateOperator);
+    if (ctx.ALIGNED() != null) {
+      // aligned
+      List<String> measurements = new ArrayList<>();
+      List<TSDataType> dataTypes = new ArrayList<>();
+      List<TSEncoding> encodings = new ArrayList<>();
+      List<CompressionType> compressors = new ArrayList<>();
+      for (IoTDBSqlParser.TemplateMeasurementClauseContext templateClauseContext :
+          ctx.templateMeasurementClause()) {
+        measurements.add(
+            parseNodeNameWithoutWildcard(templateClauseContext.nodeNameWithoutWildcard()));
+        parseAttributeClause(
+            templateClauseContext.attributeClauses(), dataTypes, encodings, compressors);
+      }
+      createTemplateOperator.addMeasurements(measurements);
+      createTemplateOperator.addDataTypes(dataTypes);
+      createTemplateOperator.addEncodings(encodings);
+      createTemplateOperator.addCompressor(compressors);
+    } else {
+      // non-aligned
+      for (IoTDBSqlParser.TemplateMeasurementClauseContext templateClauseContext :
+          ctx.templateMeasurementClause()) {
+        parseTemplateMeasurementClause(templateClauseContext, createTemplateOperator);
+      }
     }
     return createTemplateOperator;
   }
@@ -325,31 +345,9 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     List<TSDataType> dataTypes = new ArrayList<>();
     List<TSEncoding> encodings = new ArrayList<>();
     List<CompressionType> compressors = new ArrayList<>();
-    if (ctx instanceof IoTDBSqlParser.AlignedTemplateMeasurementContext) {
-      // aligned measurement
-      String alignedSuffixPath =
-          ((IoTDBSqlParser.AlignedTemplateMeasurementContext) ctx).suffixPath().getText();
-      List<IoTDBSqlParser.NodeNameWithoutWildcardContext> measurementList =
-          ((IoTDBSqlParser.AlignedTemplateMeasurementContext) ctx).nodeNameWithoutWildcard();
-      List<IoTDBSqlParser.AttributeClausesContext> attributeList =
-          ((IoTDBSqlParser.AlignedTemplateMeasurementContext) ctx).attributeClauses();
-      for (int i = 0; i < attributeList.size(); i++) {
-        measurements.add(
-            alignedSuffixPath.concat(
-                TsFileConstant.PATH_SEPARATOR
-                    + parseNodeNameWithoutWildcard(measurementList.get(i))));
-        parseAttributeClause(attributeList.get(i), dataTypes, encodings, compressors);
-      }
-    } else {
-      // non-aligned template measurement
-      measurements.add(
-          ((IoTDBSqlParser.NonAlignedTemplateMeasurementContext) ctx).suffixPath().getText());
-      parseAttributeClause(
-          ((IoTDBSqlParser.NonAlignedTemplateMeasurementContext) ctx).attributeClauses(),
-          dataTypes,
-          encodings,
-          compressors);
-    }
+    // single template measurement
+    measurements.add(parseNodeNameWithoutWildcard(ctx.nodeNameWithoutWildcard()));
+    parseAttributeClause(ctx.attributeClauses(), dataTypes, encodings, compressors);
     createTemplateOperator.addMeasurements(measurements);
     createTemplateOperator.addDataTypes(dataTypes);
     createTemplateOperator.addEncodings(encodings);
@@ -727,6 +725,16 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     return dropContinuousQueryOperator;
   }
 
+  // Drop Schema Template
+
+  @Override
+  public Operator visitDropSchemaTemplate(IoTDBSqlParser.DropSchemaTemplateContext ctx) {
+    DropTemplateOperator dropTemplateOperator =
+        new DropTemplateOperator(SQLConstant.TOK_SCHEMA_TEMPLATE_DROP);
+    dropTemplateOperator.setTemplateName(parseStringWithQuotes((ctx.templateName.getText())));
+    return dropTemplateOperator;
+  }
+
   // Set TTL
 
   @Override
@@ -929,6 +937,40 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     return new ShowTTLOperator(storageGroups);
   }
 
+  // Show Schema Template
+
+  @Override
+  public Operator visitShowSchemaTemplates(IoTDBSqlParser.ShowSchemaTemplatesContext ctx) {
+    return new ShowTemplatesOperator(SQLConstant.TOK_SCHEMA_TEMPLATE_SHOW);
+  }
+
+  // Show Measurements In Schema Template
+
+  public Operator visitShowNodesInSchemaTemplate(
+      IoTDBSqlParser.ShowNodesInSchemaTemplateContext ctx) {
+    String templateName = parseStringWithQuotes(ctx.templateName.getText());
+    return new ShowNodesInTemplateOperator(
+        SQLConstant.TOK_SCHEMA_TEMPLATE_SHOW_NODES, templateName);
+  }
+
+  // Show Paths Set Schema Template
+
+  public Operator visitShowPathsSetSchemaTemplate(
+      IoTDBSqlParser.ShowPathsSetSchemaTemplateContext ctx) {
+    String templateName = parseStringWithQuotes(ctx.templateName.getText());
+    return new ShowPathsSetTemplateOperator(
+        SQLConstant.TOK_SCHEMA_TEMPLATE_SHOW_PATHS_SET, templateName);
+  }
+
+  // Show Paths Using Schema Template
+
+  public Operator visitShowPathsUsingSchemaTemplate(
+      IoTDBSqlParser.ShowPathsUsingSchemaTemplateContext ctx) {
+    String templateName = parseStringWithQuotes(ctx.templateName.getText());
+    return new ShowPathsUsingTemplateOperator(
+        SQLConstant.TOK_SCHEMA_TEMPLATE_SHOW_PATHS_USING, templateName);
+  }
+
   // countStorageGroup
 
   @Override
diff --git a/site/src/main/.vuepress/config.js b/site/src/main/.vuepress/config.js
index e87c128..dff06b2 100644
--- a/site/src/main/.vuepress/config.js
+++ b/site/src/main/.vuepress/config.js
@@ -679,7 +679,7 @@ var config = {
 					},
 					{
 						title: 'Syntax Conventions',
-						sidebarDepth: 1,
+						sidebarDepth: 2,
 						children: [
 							['Reference/Syntax-Conventions','Syntax Conventions'],
 						]
@@ -704,6 +704,7 @@ var config = {
 							['Operate-Metadata/Storage-Group','Storage Group'],
 							['Operate-Metadata/Node','Node'],
 							['Operate-Metadata/Timeseries','Timeseries'],
+							['Operate-Metadata/Template','Schema Template'],
 							['Operate-Metadata/TTL','TTL'],
 							['Operate-Metadata/Auto-Create-MetaData','Auto Create Metadata']
 						]
@@ -863,6 +864,7 @@ var config = {
 							['Operate-Metadata/Storage-Group','Storage Group'],
 							['Operate-Metadata/Node','Node'],
 							['Operate-Metadata/Timeseries','Timeseries'],
+							['Operate-Metadata/Template','Schema Template'],
 							['Operate-Metadata/TTL','TTL'],
 							['Operate-Metadata/Auto-Create-MetaData','Auto Create Metadata']
 						]
@@ -1670,6 +1672,7 @@ var config = {
 							['Operate-Metadata/Storage-Group','存储组操作'],
 							['Operate-Metadata/Node','节点操作'],
 							['Operate-Metadata/Timeseries','时间序列操作'],
+							['Operate-Metadata/Template','元数据模板'],
 							['Operate-Metadata/TTL','TTL'],
 							['Operate-Metadata/Auto-Create-MetaData','自动创建元数据']
 						]
@@ -1831,6 +1834,7 @@ var config = {
 							['Operate-Metadata/Storage-Group','存储组操作'],
 							['Operate-Metadata/Node','节点操作'],
 							['Operate-Metadata/Timeseries','时间序列操作'],
+							['Operate-Metadata/Template','元数据模板'],
 							['Operate-Metadata/TTL','TTL'],
 							['Operate-Metadata/Auto-Create-MetaData','自动创建元数据']
 						]