Procedure to detect and return duplicates
SQL
Hard
3 views
Problem Description
Create sp_find_duplicate_emails that returns emails appearing more than once in Users.
Input Format
SQL procedure
Output Format
Procedure created
Sample Test Case
Output:
Procedure created
Constraints
Return result set
Official Solution
CREATE PROCEDURE sp_find_duplicate_emails() BEGIN SELECT email, COUNT(*) AS cnt FROM Users GROUP BY email HAVING COUNT(*) > 1; END;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!