From 04d762539f39e5dddda15ac80448faaa6828af97 Mon Sep 17 00:00:00 2001 From: gccgdb1234 Date: Fri, 10 Jun 2022 11:18:12 +0800 Subject: [PATCH] docs: add delete data in develop branch --- docs-cn/07-develop/05-delete-data.mdx | 43 +++++++++++++++++++ ...uous-query.mdx => 06-continuous-query.mdx} | 0 .../{06-subscribe.mdx => 07-subscribe.md} | 0 .../07-develop/{07-cache.md => 08-cache.md} | 0 docs-cn/07-develop/{08-udf.md => 09-udf.md} | 0 5 files changed, 43 insertions(+) create mode 100644 docs-cn/07-develop/05-delete-data.mdx rename docs-cn/07-develop/{05-continuous-query.mdx => 06-continuous-query.mdx} (100%) rename docs-cn/07-develop/{06-subscribe.mdx => 07-subscribe.md} (100%) rename docs-cn/07-develop/{07-cache.md => 08-cache.md} (100%) rename docs-cn/07-develop/{08-udf.md => 09-udf.md} (100%) diff --git a/docs-cn/07-develop/05-delete-data.mdx b/docs-cn/07-develop/05-delete-data.mdx new file mode 100644 index 0000000000..4d31da35bc --- /dev/null +++ b/docs-cn/07-develop/05-delete-data.mdx @@ -0,0 +1,43 @@ +--- +sidebar_label: 删除数据 +description: "删除指定表或超级表中的数据记录" +title: "删除数据" +--- + +删除数据是 TDengine 提供的根据指定时间段删除指定表或超级表中数据记录的功能,方便用户清理由于设备故障等原因产生的异常数据。 +注意:本功能只在企业版中提供,如需此功能请点击下面的链接访问[企业版产品](https://www.taosdata.com/products#enterprise-edition-link) + + +**语法:** + +```sql +DELETE FROM [ db_name. ] tb_name [WHERE condition]; +``` + +**功能:** 删除指定表或超级表中的数据记录 + +**参数:** + +- db_name 可选参数,指定要删除表所在的数据库名,不填写则在当前数据库中 +- tb_name 必填参数,指定要删除数据的表名,可以是普通表、子表,也可以是超级表。 +- condition 可选参数,指定删除数据的过滤条件,不指定过滤条件则为表中所有数据,请慎重使用。特别说明,这里的where 条件中只支持对第一列时间列的过滤,如果是超级表,支持对tag列过滤。 + +**特别说明:** + +数据删除后不可恢复,请慎重使用。为了确保删除的数据确实是自己要删除的,建议可以先使用 select 语句加 where 后的删除条件查看要删除的数据内容,确认无误后再执行 delete 命令。 + +**示例:** + +meters 是一个超级表,groupid 是 int 类型的 tag 列,现在要删除 meters 表中时间小于 2021-10-01 10:40:00.100 且 tag 列 groupid 值为 1 的所有数据,sql 如下: + +```sql +delete from meters where ts < '2021-10-01 10:40:00.100' and groupid=1 ; +``` + +执行后显示结果为: + +``` +Deleted 102000 row(s) from 1020 table(s) (0.421950s) +``` + +表示从 1020 个子表中共删除了 102000 行数据 diff --git a/docs-cn/07-develop/05-continuous-query.mdx b/docs-cn/07-develop/06-continuous-query.mdx similarity index 100% rename from docs-cn/07-develop/05-continuous-query.mdx rename to docs-cn/07-develop/06-continuous-query.mdx diff --git a/docs-cn/07-develop/06-subscribe.mdx b/docs-cn/07-develop/07-subscribe.md similarity index 100% rename from docs-cn/07-develop/06-subscribe.mdx rename to docs-cn/07-develop/07-subscribe.md diff --git a/docs-cn/07-develop/07-cache.md b/docs-cn/07-develop/08-cache.md similarity index 100% rename from docs-cn/07-develop/07-cache.md rename to docs-cn/07-develop/08-cache.md diff --git a/docs-cn/07-develop/08-udf.md b/docs-cn/07-develop/09-udf.md similarity index 100% rename from docs-cn/07-develop/08-udf.md rename to docs-cn/07-develop/09-udf.md -- GitLab