Skip to content
Onsite

Duplicate emails

EasyP1Coding

Table person:

ColumnType
idint (primary key)
emailtext

Write a query that returns every email that appears more than once. Return one column named email, with each duplicated email listed once.

Schema

CREATE TABLE person (
  id int PRIMARY KEY,
  email text NOT NULL
);

Example 1

Input
person: (1, 'a@x.com'), (2, 'b@x.com'), (3, 'a@x.com')
Output
email: a@x.com

Constraints

  • PostgreSQL dialect.
  • Emails are compared exactly (case-sensitive).
  • Return rows in any order.

Hints

PostgreSQL
Run checks the 2 visible tests, Submit all 6.