File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ Useful for preparing for technical interviews and improving your SQL skills.
152
152
- [ 1965. Employees With Missing Information] ( ./leetcode/easy/1965.%20Employees%20With%20Missing%20Information.sql )
153
153
- [ 1978. Employees Whose Manager Left the Company] ( ./leetcode/easy/1978.%20Employees%20Whose%20Manager%20Left%20the%20Company.sql )
154
154
- [ 2356. Number of Unique Subjects Taught by Each Teacher] ( ./leetcode/easy/2356.%20Number%20of%20Unique%20Subjects%20Taught%20by%20Each%20Teacher.sql )
155
+ - [ 3436. Find Valid Emails] ( ./leetcode/easy/3436.%20Find%20Valid%20Emails.sql )
155
156
2 . [ Medium] ( ./leetcode/medium/ )
156
157
- [ 176. Second Highest Salary] ( ./leetcode/medium/176.%20Second%20Highest%20Salary.sql )
157
158
- [ 180. Consecutive Numbers] ( ./leetcode/medium/180.%20Consecutive%20Numbers.sql )
Original file line number Diff line number Diff line change
1
+ /*
2
+ Question 3436. Find Valid Emails
3
+ Link: https://leetcode.com/problems/find-valid-emails/description/?envType=problem-list-v2&envId=database
4
+
5
+ Table: Users
6
+
7
+ +-----------------+---------+
8
+ | Column Name | Type |
9
+ +-----------------+---------+
10
+ | user_id | int |
11
+ | email | varchar |
12
+ +-----------------+---------+
13
+ (user_id) is the unique key for this table.
14
+ Each row contains a user's unique ID and email address.
15
+ Write a solution to find all the valid email addresses. A valid email address meets the following criteria:
16
+
17
+ It contains exactly one @ symbol.
18
+ It ends with .com.
19
+ The part before the @ symbol contains only alphanumeric characters and underscores.
20
+ The part after the @ symbol and before .com contains a domain name that contains only letters.
21
+ Return the result table ordered by user_id in ascending order.
22
+ */
23
+
24
+ SELECT
25
+ user_id,
26
+ email
27
+ FROM Users
28
+ WHERE email ~ ' ^([a-zA-Z0-9]?[_]?[a-zA-Z0-9]?)*@[a-zA-Z]+\. com$'
29
+ ORDER BY user_id ASC
You can’t perform that action at this time.
0 commit comments