----------------(1) CREATE TABLE "BinarPlatinum".trialaja ( fruit varchar NULL ); ----------------------(2) insert into trialaja (fruit) values ('mango') --------------------(3) select * from trialaja as t; ------(not working without primary key, delete all) (4) delete from trialaja where fruit in( select fruit from( select *,row_number()over(partition by fruit) as rn from trialaja as t ) t1 where rn > 1 ) select * from trialaja as t; ------------------------------------------------------------------------------------------------ ---(working without pirmary key) menggunakan delete from trialaja WHERE ctid IN (SELECT ctid FROM (SELECT ctid, fruit, ROW_NUMBER() OVER ( PARTITION BY fruit) AS rn FROM trialaja as t) b WHERE rn > 1); select * from trialaja as t;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter