Skip to content

Commit 4a7907f

Browse files
committed
task: #1517
1 parent eb3d573 commit 4a7907f

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Have a good contributing!
6161
- [1378. Replace Employee ID With The Unique Identifier](./leetcode/easy/1378.%20Replace%20Employee%20ID%20With%20The%20Unique%20Identifier.sql)
6262
- [1407. Top Travellers](./leetcode/easy/1407.%20Top%20Travellers.sql)
6363
- [1484. Group Sold Products By The Date](./leetcode/easy/1484.%20Group%20Sold%20Products%20By%20The%20Date.sql)
64+
- [1517. Find Users With Valid E-Mails](./leetcode/easy/1517.%20Find%20Users%20With%20Valid%20E-Mails.sql)
6465
- [1527. Patients With a Condition](./leetcode/easy/1527.%20Patients%20With%20a%20Condition.sql)
6566
- [1581. Customer Who Visited but Did Not Make Any Transactions](./leetcode/easy/1581.%20Customer%20Who%20Visited%20but%20Did%20Not%20Make%20Any%20Transactions.sql)
6667
- [1587. Bank Account Summary II](./leetcode/easy/1587.%20Bank%20Account%20Summary%20II.sql)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
Question 1517. Find Users With Valid E-Mails
3+
Link: https://leetcode.com/problems/find-users-with-valid-e-mails/description/?envType=study-plan-v2&envId=top-sql-50
4+
5+
Table: Users
6+
7+
+---------------+---------+
8+
| Column Name | Type |
9+
+---------------+---------+
10+
| user_id | int |
11+
| name | varchar |
12+
| mail | varchar |
13+
+---------------+---------+
14+
user_id is the primary key (column with unique values) for this table.
15+
This table contains information of the users signed up in a website. Some e-mails are invalid.
16+
17+
18+
Write a solution to find the users who have valid emails.
19+
20+
A valid e-mail has a prefix name and a domain where:
21+
22+
The prefix name is a string that may contain letters (upper or lower case), digits, underscore '_', period '.', and/or dash '-'. The prefix name must start with a letter.
23+
The domain is '@leetcode.com'.
24+
Return the result table in any order.
25+
*/
26+
27+
SELECT
28+
user_id,
29+
name, --noqa: RF04
30+
mail
31+
FROM Users
32+
WHERE mail ~ '^[a-zA-Z]+([a-zA-Z0-9]?[._-]?[a-zA-Z0-9]?)*@leetcode\.com$'

0 commit comments

Comments
 (0)