Duplicate Emails, duplicateemails

Source: Internet
Author: User

Duplicate Emails, duplicateemails

Write a SQL query to find all duplicate emails in a table named Person. + ---- + --------- + | Id | Email | + ---- + --------- + | 1 | a@ B .com | 2 | c@d.com | 3 | a@ B .com | + ---- + --------- + For example, your query shocould return the following for the above table: + --------- + | Email | + --------- + | a@ B .com | + --------- + Note: All emails are in lowercase. mainly group by applications select Email from (select Email, co Unt (Email) as cnt from Person group by Email) t where cnt> 1; or select Email from (select Email, count (Email) as cnt from Person group by Email having cnt> 1) t; order by must be used after group by and cannot be used before group. Select Email from (select Email, count (Email) as cnt from Person order by Email group by Email) t where cnt> 1; this execution may be faulty.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.