添加链接
注册
登录
link管理
链接快照平台
输入网页链接,自动生成快照
标签化管理网页链接
相关文章推荐
高大的手术刀
·
"夹缝男孩"回家
·
2 天前
·
冷静的柳树
·
将linux和uboot集成到Android ...
·
3 周前
·
坚韧的包子
·
C# ...
·
2 月前
·
坏坏的西红柿
·
CHALECO SIN MANGA CON ...
·
2 月前
·
坐怀不乱的丝瓜
·
福建省网上办事大厅-福建政务服务网-马上就办 ...
·
5 月前
·
link管理
›
超级表 | TDengine 文档 | 涛思数据
https://docs.taosdata.com/taos-sql/stable/
飘逸的电池
4 月前
Skip to main content
</a><a href="https://www.taosdata.com/events/tdcon2024?utm_source=tdcn&utm_medium=doc&utm_campaign=menu" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">用户大会</a><a href="https://www.taosdata.com/blog" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">博客</a><a href="https://www.taosdata.com/contactUs" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">联系我们</a><a href="https://cloud.taosdata.com/" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Cloud</a><div class="navbarSearchContainer_Bca1"/></div></div><div role="presentation" class="navbar-sidebar__backdrop"/></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0"><div class="docsWrapper_hBAB"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"/><div class="docRoot_UBD9"><aside class="theme-doc-sidebar-container docSidebarContainer_YfHR"><div class="sidebarViewport_aRkj"><div class="sidebar_gi4H sidebarWithHideableNavbar_vOD8"><a href="https://www.taosdata.com" target="_blank" rel="noopener noreferrer" tabindex="-1" class="sidebarLogo_YnPk"><img src="/img/site-logo.png" alt="" class="themedComponent_mlkZ themedComponent--light_NVdE"/><img src="/img/site-logo.png" alt="" class="themedComponent_mlkZ themedComponent--dark_xIcU"/><b/></a><div class="sidebarTop_Qw2W"><div class="versionDropdownWrapper_Qxj6"><select name="version" class="versionSelect_lz6N"><option value="3.0" selected="">v3.0</option><option value="2.6">v2.6</option><option value="2.4">v2.4</option><option value="cloud">Cloud</option><option value="2.0">v2.0</option><option value="1.6">v1.6</option></select></div><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewbox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"/></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"/></button></div><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_Y1UP"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">文档首页</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/intro/">产品简介</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/concept/">基本概念</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/get-started/">立即开始</a><button aria-label="Expand sidebar category '立即开始'" type="button" class="clean-btn menu__caret"/></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/develop/">开发指南</a><button aria-label="Expand sidebar category '开发指南'" type="button" class="clean-btn menu__caret"/></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/connector/">连接器</a><button aria-label="Expand sidebar category '连接器'" type="button" class="clean-btn menu__caret"/></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/deployment/">部署集群</a><button aria-label="Expand sidebar category '部署集群'" type="button" class="clean-btn menu__caret"/></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/taos-sql/">SQL 手册</a><button aria-label="Collapse sidebar category 'SQL 手册'" type="button" class="clean-btn menu__caret"/></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/data-type/">数据类型</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/database/">数据库</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/table/">表</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/taos-sql/stable/">超级表</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/insert/">数据写入</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/select/">数据查询</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/tag-index/">标签索引</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/delete-data/">删除数据</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/function/">函数</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/distinguished/">特色查询</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/tmq/">数据订阅</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/stream/">流式计算</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/operators/">运算符</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/json/">JSON 类型</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/escape/">转义字符</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/limit/">命名与边界</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/keywords/">保留关键字</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/node/">集群管理</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/meta/">元数据</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/perf/">统计数据</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/show/">SHOW 命令</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/grant/">用户管理</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/udf/">自定义函数</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/indexing/">窗口预聚集</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/recovery/">异常恢复</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/changes/">语法变更</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/taos-sql/join/">关联查询</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/reference/">参考手册</a><button aria-label="Expand sidebar category '参考手册'" type="button" class="clean-btn menu__caret"/></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/operation/">运维指南</a><button aria-label="Expand sidebar category '运维指南'" type="button" class="clean-btn menu__caret"/></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/third-party/">第三方工具</a><button aria-label="Expand sidebar category '第三方工具'" type="button" class="clean-btn menu__caret"/></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/tdinternal/">技术内幕</a><button aria-label="Expand sidebar category '技术内幕'" type="button" class="clean-btn menu__caret"/></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/application/">应用实践</a><button aria-label="Expand sidebar category '应用实践'" type="button" class="clean-btn menu__caret"/></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/train-faq/">FAQ 及其他</a><button aria-label="Expand sidebar category 'FAQ 及其他'" type="button" class="clean-btn menu__caret"/></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/releases/tdengine/">发布历史</a></div></li></ul></nav></div></div></aside><main class="docMainContainer_TBSr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>超级表</h1></header><h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="创建超级表">创建超级表<a href="#创建超级表" class="hash-link" aria-label="Direct link to 创建超级表" title="Direct link to 创建超级表"></a></h2> <div class="language-sql codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-sql codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">CREATE</span><span class="token plain"> STABLE </span><span class="token punctuation" style="color:#393A34">[</span><span class="token keyword" style="color:#00009f">IF</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">NOT</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">EXISTS</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> stb_name </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">create_definition </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> create_definition</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> TAGS </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">create_definition </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> create_definition</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">table_options</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"/><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">create_definition:</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> col_name column_definition</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">column_definition:</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> type_name</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <li>超级表中列的最大个数为 4096,需要注意,这里的 4096 是包含 TAG 列在内的,最小 个数为 3,包含一个时间戳主键、一个 TAG 列和一个数据列。</li> <li>TAGS语法指定超级表的标签列,标签列需要遵循以下约定:<!-- --> <li>TAGS 中的 TIMESTAMP 列写入数据时需要提供给定值,而暂不支持四则运算,例如 NOW + 10s 这类表达式。</li> <li>TAGS 列名不能与其他列名相同。</li> <li>TAGS 列名不能为预留关键字。</li> <li>TAGS 最多允许 128 个,至少 1 个,总长度不超过 16 KB。</li> <li>关于表参数的详细说明,参见 CREATE TABLE 中的介绍。</li> <h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="查看超级表">查看超级表<a href="#查看超级表" class="hash-link" aria-label="Direct link to 查看超级表" title="Direct link to 查看超级表"></a></h2> <h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="显示当前数据库下的所有超级表信息">显示当前数据库下的所有超级表信息<a href="#显示当前数据库下的所有超级表信息" class="hash-link" aria-label="Direct link to 显示当前数据库下的所有超级表信息" title="Direct link to 显示当前数据库下的所有超级表信息"></a></h3> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">SHOW STABLES [LIKE tb_name_wildcard];</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <p>查看数据库内全部超级表。</p> <h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="显示一个超级表的创建语句">显示一个超级表的创建语句<a href="#显示一个超级表的创建语句" class="hash-link" aria-label="Direct link to 显示一个超级表的创建语句" title="Direct link to 显示一个超级表的创建语句"></a></h3> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">SHOW CREATE STABLE stb_name;</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <p>常用于数据库迁移。对一个已经存在的超级表,返回其创建语句;在另一个集群中执行该语句,就能得到一个结构完全相同的超级表。</p> <h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="获取超级表的结构信息">获取超级表的结构信息<a href="#获取超级表的结构信息" class="hash-link" aria-label="Direct link to 获取超级表的结构信息" title="Direct link to 获取超级表的结构信息"></a></h3> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">DESCRIBE [db_name.]stb_name;</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="获取超级表中所有子表的标签信息">获取超级表中所有子表的标签信息<a href="#获取超级表中所有子表的标签信息" class="hash-link" aria-label="Direct link to 获取超级表中所有子表的标签信息" title="Direct link to 获取超级表中所有子表的标签信息"></a></h3> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">SHOW TABLE TAGS FROM table_name [FROM db_name];</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">SHOW TABLE TAGS FROM [db_name.]table_name;</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">taos> SHOW TABLE TAGS FROM st1;</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> tbname | id | loc |</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">======================================================================</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> st1s1 | 1 | beijing |</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> st1s2 | 2 | shanghai |</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> st1s3 | 3 | guangzhou |</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">Query OK, 3 rows in database (0.004455s)</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <p>返回结果集的第一列为子表名,后续列为标签列。</p> <p>如果已经知道标签列的名称,可以使用下面的语句来获取指定标签列的值。</p> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">taos> SELECT DISTINCT TBNAME, id FROM st1;</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> tbname | id |</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">===============================================</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> st1s1 | 1 |</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> st1s2 | 2 |</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> st1s3 | 3 |</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">Query OK, 3 rows in database (0.002891s)</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <p>需要注意,SELECT 语句中的 DISTINCT 和 TBNAME 都是必不可少的,TDengine 会根据它们对语句进行优化,使之在没有数据或数据非常多的情况下都可以正确并快速的返回标签值。</p> <h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="获取某个子表的标签信息">获取某个子表的标签信息<a href="#获取某个子表的标签信息" class="hash-link" aria-label="Direct link to 获取某个子表的标签信息" title="Direct link to 获取某个子表的标签信息"></a></h3> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">taos> SHOW TAGS FROM st1s1;</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> table_name | db_name | stable_name | tag_name | tag_type | tag_value |</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">============================================================================================================</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> st1s1 | test | st1 | id | INT | 1 |</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> st1s1 | test | st1 | loc | VARCHAR(20) | beijing |</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">Query OK, 2 rows in database (0.003684s)</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <p>同样的,也可以用 SELECT 语句来查询指定标签列的值。</p> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">taos> SELECT DISTINCT TBNAME, id, loc FROM st1s1;</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> tbname | id | loc |</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">==================================================</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> st1s1 | 1 | beijing |</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">Query OK, 1 rows in database (0.001884s)</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="删除超级表">删除超级表<a href="#删除超级表" class="hash-link" aria-label="Direct link to 删除超级表" title="Direct link to 删除超级表"></a></h2> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">DROP STABLE [IF EXISTS] [db_name.]stb_name</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <p>删除 STable 会自动删除通过 STable 创建的子表以及子表中的所有数据。</p> <p><strong>注意</strong>:删除超级表并不会立即释放该表所占用的磁盘空间,而是把该表的数据标记为已删除,在查询时这些数据将不会再出现,但释放磁盘空间会延迟到系统自动或用户手动进行数据重整时。</p> <h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="修改超级表">修改超级表<a href="#修改超级表" class="hash-link" aria-label="Direct link to 修改超级表" title="Direct link to 修改超级表"></a></h2> <div class="language-sql codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-sql codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">ALTER</span><span class="token plain"> STABLE </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">db_name</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain">tb_name alter_table_clause</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">alter_table_clause: {</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> alter_table_options</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">ADD</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">COLUMN</span><span class="token plain"> col_name column_type</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">DROP</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">COLUMN</span><span class="token plain"> col_name</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">MODIFY</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">COLUMN</span><span class="token plain"> col_name column_type</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">ADD</span><span class="token plain"> TAG tag_name tag_type</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">DROP</span><span class="token plain"> TAG tag_name</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">MODIFY</span><span class="token plain"> TAG tag_name tag_type</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token operator" style="color:#393A34">|</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">RENAME</span><span class="token plain"> TAG old_tag_name new_tag_name</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">}</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">alter_table_options:</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> alter_table_option </span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"/><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">alter_table_option: {</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">COMMENT</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'string_value'</span><span class="token plain"/><br/></span><span class="token-line" style="color:#393A34"><span class="token plain">}</span><br/></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"/><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <p>修改超级表的结构会对其下的所有子表生效。无法针对某个特定子表修改表结构。标签结构的修改需要对超级表下发,TDengine 会自动作用于此超级表的所有子表。</p> <li>ADD COLUMN:添加列。</li> <li>DROP COLUMN:删除列。</li> <li>MODIFY COLUMN:修改列的宽度,数据列的类型必须是 nchar 和 binary,使用此指令可以修改其宽度,只能改大,不能改小。</li> <li>ADD TAG:给超级表添加一个标签。</li> <li>DROP TAG:删除超级表的一个标签。从超级表删除某个标签后,该超级表下的所有子表也会自动删除该标签。</li> <li>MODIFY TAG:修改超级表的一个标签的列宽度。标签的类型只能是 nchar 和 binary,使用此指令可以修改其宽度,只能改大,不能改小。</li> <li>RENAME TAG:修改超级表的一个标签的名称。从超级表修改某个标签名后,该超级表下的所有子表也会自动更新该标签名。</li> <li>与普通表一样,超级表的主键列不允许被修改,也不允许通过 ADD/DROP COLUMN 来添加或删除主键列。</li> <h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="增加列">增加列<a href="#增加列" class="hash-link" aria-label="Direct link to 增加列" title="Direct link to 增加列"></a></h3> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">ALTER STABLE stb_name ADD COLUMN col_name column_type;</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="删除列">删除列<a href="#删除列" class="hash-link" aria-label="Direct link to 删除列" title="Direct link to 删除列"></a></h3> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">ALTER STABLE stb_name DROP COLUMN col_name;</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="修改列宽">修改列宽<a href="#修改列宽" class="hash-link" aria-label="Direct link to 修改列宽" title="Direct link to 修改列宽"></a></h3> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">ALTER STABLE stb_name MODIFY COLUMN col_name data_type(length);</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <p>如果数据列的类型是可变长格式(BINARY 或 NCHAR),那么可以使用此指令修改其宽度(只能改大,不能改小)。</p> <h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="添加标签">添加标签<a href="#添加标签" class="hash-link" aria-label="Direct link to 添加标签" title="Direct link to 添加标签"></a></h3> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">ALTER STABLE stb_name ADD TAG tag_name tag_type;</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <p>为 STable 增加一个新的标签,并指定新标签的类型。标签总数不能超过 128 个,总长度不超过 16KB 。</p> <h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="删除标签">删除标签<a href="#删除标签" class="hash-link" aria-label="Direct link to 删除标签" title="Direct link to 删除标签"></a></h3> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">ALTER STABLE stb_name DROP TAG tag_name;</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <p>删除超级表的一个标签,从超级表删除某个标签后,该超级表下的所有子表也会自动删除该标签。</p> <h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="修改标签名">修改标签名<a href="#修改标签名" class="hash-link" aria-label="Direct link to 修改标签名" title="Direct link to 修改标签名"></a></h3> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">ALTER STABLE stb_name RENAME TAG old_tag_name new_tag_name;</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <p>修改超级表的标签名,从超级表修改某个标签名后,该超级表下的所有子表也会自动更新该标签名。</p> <h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="修改标签列宽度">修改标签列宽度<a href="#修改标签列宽度" class="hash-link" aria-label="Direct link to 修改标签列宽度" title="Direct link to 修改标签列宽度"></a></h3> <div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">ALTER STABLE stb_name MODIFY TAG tag_name data_type(length);</span><br/></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewbox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"/></svg><svg viewbox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg></span></button></div></div></div> <p>如果标签的类型是可变长格式(BINARY 或 NCHAR),那么可以使用此指令修改其宽度(只能改大,不能改小)。(2.1.3.0 版本新增)</p>
推荐文章
高大的手术刀
·
"夹缝男孩"回家
2 天前
冷静的柳树
·
将linux和uboot集成到Android编译框架中 - 摩斯电码 - 博客园
3 周前
坚韧的包子
·
C# string转换成DateTime?(字符串转换成可空日期类型)-十有三博客
2 月前
坏坏的西红柿
·
CHALECO SIN MANGA CON CREMALLERA - KAIXUAN VICTORY S.L
2 月前
坐怀不乱的丝瓜
·
福建省网上办事大厅-福建政务服务网-马上就办 · 全程网办 · 一网通办
5 月前