List Email Spellings That Occur More Than Once

Quick Overview

Return each email spelling that appears more than once, with one row for each repeated spelling.

List Email Spellings That Occur More Than Once

Company: Google

Role: Software Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

### Problem List every duplicate email from Person once, under the output label Email. The email field is guaranteed non-NULL and contains no uppercase letters. Row ordering is unrestricted. ### Tables Table: `Person` ```text +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | email | varchar | +-------------+---------+ id is the primary key (column with unique values) for this table. Each row of this table contains an email. The emails will not contain uppercase letters. ``` ### Example ```text Person (id,email): (1,a@example.net), (2,b@example.net), (3,a@example.net), (4,a@example.net) Output (Email): (a@example.net) ``` ### What a Strong Answer Covers - Report each duplicated spelling exactly once. - Keep the requested output label and leave single occurrences out. ### Follow-up Questions - How would you report the number of occurrences alongside each duplicate? - How would you change the rule if email matching were case-insensitive?

Overview: Return each email spelling that appears more than once, with one row for each repeated spelling.

Google logo
Google
easySoftware EngineerOtherData Manipulation (SQL/Python)
0
0

Problem

List every duplicate email from Person once, under the output label Email. The email field is guaranteed non-NULL and contains no uppercase letters. Row ordering is unrestricted.

Tables

Table: Person

+-------------+---------+
| Column Name | Type    |
+-------------+---------+
| id          | int     |
| email       | varchar |
+-------------+---------+
id is the primary key (column with unique values) for this table.
Each row of this table contains an email. The emails will not contain uppercase letters.

Example

Person (id,email): (1,a@example.net), (2,b@example.net), (3,a@example.net), (4,a@example.net)
Output (Email): (a@example.net)

What a Strong Answer Covers Guidance

  • Report each duplicated spelling exactly once.
  • Keep the requested output label and leave single occurrences out.

Follow-up Questions Guidance

  • How would you report the number of occurrences alongside each duplicate?
  • How would you change the rule if email matching were case-insensitive?