MYSQL FREE QUESTION LEETCODE
IntuitionApproachComplexity
Time complexity:

Space complexity:
Codeand subs2 REGEXP '[a-zA-Z]*
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```mysql []
# Write your MySQL query statement below
with cte as(
select Users.*,LOCATE('@',email) as r1,LOCATE('@',email,LOCATE('@',email)) as r2
FROM Users where LOCATE('@',email,LOCATE('@',email))!=0 and email LIKE '%.com'
),cte1 as(
select cte.*,SUBSTRING(email,1,r1-1) as subs1,SUBSTRING(email,r1+1,LENGTH(email)-r1-4)
as subs2 FROM cte
)
select user_id,email FROM cte1 where subs1 REGEXP '^[a-zA-Z0-9-]*
```
and subs2 REGEXP '[a-zA-Z]*
```;
```
['MySQL']