The SQL statement of creating STable is similar to that of creating table, but a special column named as`TAGS` must be specified with the names and types of the tags.
The SQL statement of creating a STable is similar to that of creating a table, but a special column set named`TAGS` must be specified with the names and types of the tags.
:::info
1. The tag types specified in TAGS should NOT be timestamp. Since 2.1.3.0 timestamp type can be used in TAGS column, but its value must be fixed and arithmetic operation can't be applied on it.
2. The tag names specified in TAGS should NOT be same as other columns.
3. The tag names specified in TAGS should NOT be same as any reserved keywords.(Please refer to [keywords](/taos-sql/keywords/)
4. The maximum number of tags specified in TAGS is 128, but there must be at least one tag, and the total length of all tag columns should NOT exceed 16KB.
2. The tag names specified in TAGS should NOT be the same as other columns.
3. The tag names specified in TAGS should NOT be the same as any reserved keywords.(Please refer to [keywords](/taos-sql/keywords/)
4. The maximum number of tags specified in TAGS is 128, there must be at least one tag, and the total length of all tag columns should NOT exceed 16KB.
:::
...
...
@@ -32,7 +32,7 @@ The SQL statement of creating STable is similar to that of creating table, but a
DROP STable [IF EXISTS] stb_name;
```
All the sub-tables created using the deleted STable will be deleted automatically.
All the subtables created using the deleted STable will be deleted automatically.
## Show All STables
...
...
@@ -40,7 +40,7 @@ All the sub-tables created using the deleted STable will be deleted automaticall
SHOW STableS [LIKE tb_name_wildcard];
```
This command can be used to display the information of all STables in the current database, including name, creation time, number of columns, number of tags, number of tables created using this STable.
This command can be used to display the information of all STables in the current database, including name, creation time, number of columns, number of tags, and number of tables created using this STable.
## Show The Create Statement of A STable
...
...
@@ -48,7 +48,7 @@ This command can be used to display the information of all STables in the curren
SHOW CREATE STable stb_name;
```
This command is useful in migrating data from one TDengine cluster to another one because it can be used to create an exactly same STable in the target database.
This command is useful in migrating data from one TDengine cluster to another because it can be used to create the exact same STable in the target database.
## Get STable Definition
...
...
@@ -94,7 +94,7 @@ This command is used to add a new tag for a STable and specify the tag type.
ALTER STable stb_name DROP TAG tag_name;
```
The tag will be removed automatically from all the sub tables crated using the super table as template once a tag is removed from a super table.
The tag will be removed automatically from all the subtables created using the super table as template once a tag is removed from a super table.
### Change A Tag
...
...
@@ -102,7 +102,7 @@ The tag will be removed automatically from all the sub tables crated using the s
ALTER STable stb_name CHANGE TAG old_tag_name new_tag_name;
```
The tag name will be changed automatically from all the sub tables crated using the super table as template once a tag name is changed for a super table.
The tag name will be changed automatically for all the subtables created using the super table as template once a tag name is changed for a super table.
### Change Tag Length
...
...
@@ -113,6 +113,6 @@ ALTER STable stb_name MODIFY TAG tag_name data_type(length);
This command can be used to change (or increase, more specifically) the length of a tag of variable length types, like BINARY or NCHAR.
:::note
Changing tag value can be applied to only sub tables. All other tag operations, like add tag, remove tag, however, can be applied to only STable. If a new tag is added for a STable, the tag will be added with NULL value for all its sub tables.
Changing tag values can be applied to only subtables. All other tag operations, like add tag, remove tag, however, can be applied to only STable. If a new tag is added for a STable, the tag will be added with NULL value for all its subtables.