1517. Find Users With Valid E-Mails
Problem Statement
Find users with a valid email, defined as starting with a letter, followed by letters/digits/underscore/period/dash, then '@leetcode.com'. Return the result table in any order.
Table Schema
Table: Users
+-------------+---------+
| user_id | int |
| name | varchar |
| mail | varchar |
+-------------+---------+
user_id is the primary key.
Examples
Example 1
Input Table:
Users table:
+---------+-----------+-------------------------+
| user_id | name | mail |
+---------+-----------+-------------------------+
| 1 | Winston | winston@leetcode.com |
| 2 | Jonathan | jonathanisgreat |
| 3 | Annabelle | bella-@leetcode.com |
+---------+-----------+-------------------------+
Expected Output:
+---------+-----------+----------------------+
| user_id | name | mail |
+---------+-----------+----------------------+
| 1 | Winston | winston@leetcode.com |
| 3 | Annabelle | bella-@leetcode.com |
+---------+-----------+----------------------+
SQL Solution
SELECT user_id, name, mail
FROM Users
WHERE mail REGEXP '^[A-Za-z][A-Za-z0-9_.-]*@leetcode\\.com$';
Problem Info
DifficultyEASY
Topics
regexpstring-functions
Reference Links