Duplicate emails
EasyP1Coding
Table person:
| Column | Type |
|---|---|
| id | int (primary key) |
| text |
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
Give it a real attempt first. Run shows which examples fail.
Saved automatically
PostgreSQL
Run checks the 2 visible tests, Submit all 6. ⌘Enter runs, ⌘⇧Enter submits.