@Rishikesh-c9r

with cte as ( select *, row_count() over (partition by empname order by empname) as rn from table_name )
delete from cte where rn>1

@aniketkatre4627

So simple query to ignore group by and having clause.. Thanks please keep it up.

@snood101

super nice solution..you just got another subscriber

@Coder_Satyabrata_S

This is very easy without using cte and row_number partition

@sachinsoni8980

Hi Sir, a big fan. 
Why > and not = in the second where clause?

@StalPho

If some employees have the same name, then how this will be work. Because employee id should be unique and we can't delete the rows based on name. That's not a meaningful one πŸ€”

@dharanishsakthivel8794

we can use window functions as well.

@alibasha202

This was so simple, I used CTE and partition which is difficult compared with this one.

@EldhoLikesIt

Simple explanation, thanks

@userzzzabc

use this 

delete from emp e
where exists ( select 1 from emp where empname=e.empname and empid>e.empid)

1000x times faster than your query

@guiltycrown6024

This  leetcode easy level question ..easy and medium from leetcode.is enough to crack any interview..

@anirudh2704

Better to use partition

@niranjanpalekar3504

Thank you sir πŸ™πŸ™πŸ™

@ravivishwakarma7786

How does it work internally?

@bharathbaskran

Why can't we use distinct

@jsdawoodahmed2931

What's this method name?

@samidfc

Duplicate records means empid too is same and not different

@fazilrahmanz9797

Good one man keep going..

@rishiplaysyt3334

Why cant we use distinct??

@p.karthik-6569

There is no colums e1 and e2 πŸ€”πŸ€”πŸ€”are these temporary names(rows)?