数据仓库服务 GAUSSDB(DWS)-DELETE:示例

时间:2024-01-25 15:18:14

示例

创建表reason_t2:
1
2
3
4
5
6
7
CREATE TABLE reason_t2
(
    TABLE_SK          INTEGER               ,
    TABLE_ID          VARCHAR(20)           ,
    TABLE_NA          VARCHAR(20)
)WITH(ORIENTATION=COLUMN, ENABLE_HSTORE=ON);
INSERT INTO reason_t2 VALUES (1, 'S01', 'StudentA'),(2, 'T01', 'TeacherA'),(3, 'T02', 'TeacherB');
使用WHERE 条件删除:
1
2
DELETE FROM reason_t2 WHERE TABLE_SK = 2;
DELETE FROM reason_t2 AS rt2 WHERE rt2.TABLE_SK = 2;
使用IN语法删除:
1
DELETE FROM reason_t2 WHERE TABLE_SK in (1,3);
support.huaweicloud.com/HybridDevg-dws/dws_15_00007.html