更新时间:2024-07-19 GMT+08:00

DELETE RECORDS from CARBON TABLE

命令功能

DELETE RECORDS命令从CarbonData表中删除记录。

命令格式

DELETE FROM CARBON_TABLE [WHERE expression];

参数描述

表1 DELETE RECORDS参数

参数

描述

CARBON TABLE

在其中执行删除操作的CarbonData表的名称。

注意事项

  • 删除segment将删除相应segment的所有二级索引。
  • 如果查询的表设置了carbon.input.segments属性,则DELETE操作失败。要解决该问题,在查询前执行以下语句。

    语法:

    SET carbon.input.segments. <database_name>.<table_name>=*;

示例

  • 示例1:

    delete from columncarbonTable1 d where d.column1 = 'country';

  • 示例2:

    delete from dest where column1 IN ('country1', 'country2');

  • 示例3:

    delete from columncarbonTable1 where column1 IN (select column11 from sourceTable2);

  • 示例4:

    delete from columncarbonTable1 where column1 IN (select column11 from sourceTable2 where column1 = 'xxx');

  • 示例5:

    delete from columncarbonTable1 where column2 >= 4;

系统响应

可在driver日志和客户端中查看命令运行成功或失败。