Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Rows to Keep After Deduplication

Keep only the row with the lowest id for each email. Return the id and email of the rows that survive, ordered by id. (This is the SELECT behind the usual DELETE.)

Table schema

Users(id INT PRIMARY KEY, email VARCHAR(30))

Sample data

id | email
1 | a@x.com
2 | b@x.com
3 | a@x.com
4 | c@x.com
5 | b@x.com

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.