建表并插入数据
create table test(id int, name varchar);
insert into test values(1,'a'),(1,'a'),(2,'b');
select * from test;
结果:
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190108184141535.png)
select ctid,* from test;
结果:
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190108184204142.png)
delete from test where ctid not in (select min(ctid) from test group by id);
select ctid,* from test;
![在这里插入图片描述](https://img-blog.csdnimg.cn/2019081213390720.png)