test=# create table t1 as select * from generate_series(1,10) s;
SELECT 10
test=# create table t2 as select * from generate_series(5,15) s;
SELECT 11
test=# select * from t1;
s
----
1
2
3
4
5
6
7
8
9
10
(10 rows)
test=# select * from t2;
s
----
5
6
7
8
9
10
11
12
13
14
15
(11 rows)
test=# delete from t1 where s in (select * from t1 intersect select * from t2);
DELETE 6
test=# select * from t1;
s
---
1
2
3
4
(4 rows)