带条件删除
```sqlselect * from tbase;
id | nickname |
2 | TBase 好 |
1 | Hello TBase |
3 | |
4 | TBase good |
delete from tbase where id=4;
null 条件的表达方式
delete from tbase where nickname is null;
select * from tbase;
id | nickname |
2 | TBase 好 |
1 | Hello TBase |
多表关联删除数据
set prefer_olap to on;
delete from tbase using t_appoint_col where tbase.id=t_appoint_col.id;
select * from tbase;
id | nickname |
2 | TBase 好 |
返回删除数据
delete from tbase returning *;
id | nickname |
2 | TBase 好 |
删除所有数据
insert into tbase select t,random()::text from generate_series(1,100000) as t;
truncate table tbase;