Find Valid Emails

ASKED IN INTERVIEW
2pts
Microsoft

Problem Statement

Microsoft security protocols require a regular audit of user accounts to ensure only internal corporate emails are associated with administrative privileges.

Your task is to identify all users who have a valid internal email address. A valid internal email address must end with the specific domain suffix: @thequerylab.com.

Rules:

  • The email must end exactly with @thequerylab.com.
  • Emails with the domain appearing in the middle (e.g., [email protected]) are considered invalid.
  • Output columns: user_id, name, email.
  • Results must be sorted by user_id in ascending order.
Tests your understanding of
String Matching, Filtering and Pattern Matching

Input Tables

users
user_id(INTEGER)name(VARCHAR)email(VARCHAR)
1Alice[email protected]
2Bob[email protected]
3Charlie[email protected]
4David[email protected]
5Eve[email protected]
6Frank[email protected]
account_status
user_id(INTEGER)is_active(BOOLEAN)
1true
2true
4false
login_logs
log_id(INTEGER)user_id(INTEGER)login_date(DATE)
10112026-02-01
10212026-02-05

Expected Output

user_id(INTEGER)name(VARCHAR)email(VARCHAR)
1Alice[email protected]
4David[email protected]

Tags

EasyASKED IN INTERVIEWString MatchingFilteringPattern Matching
5-10 min
89%

Hints