You need to enable JavaScript to run this app.
导航
删除语句 (DELETE)
最近更新时间:2024.11.20 14:45:43首次发布时间:2024.11.01 11:00:45

说明

当前只支持Unique表,对于其他场景请参考 "ALTER TABLE ... DELETE"语句。。

语法

DELETE FROM [db.]table WHERE expr;

示例

DELETE FROM musics WHERE Title LIKE '%hello%';

注意

数据为全分区数据,建议通过DROP PARTITION命令进行删除,更高效和快速。

DROP PARTITION 命令删除分区,参考如下:

# 如果分区为该类型:PARTITION BY x
ALTER TABLE t DROP PARTITION '2009-08-01',

# 如果分区为该类型:PARTITION BY toYYYYMMDD(toDate(x))
ALTER TABLE t DROP PARTITION WHERE `toYYYYMMDD(toDate(x))` = toYYYYMMDD(yesterday());

# 如果分区为该类型:PARTITION BY toYYYYMMDD(toDateTime(x))
ALTER TABLE t DROP PARTITION WHERE `toYYYYMMDD(toDateTime(x))` = toYYYYMMDD(yesterday());

# 如果分区为该类型:PARTITION BY toDate(x)
ALTER TABLE t DROP PARTITION WHERE `toDate(x)` = yesterday();