C++ STL 1. Pair : Syntax : pair <int,char> p1; it creates a pair {2,'c'} like this. pair <int,int> p2; it creates a pair {2,3} like this . Basic Code : #include <bits/stdc++.h> using namespace std; int main() { // cout<<"hello world\n"; pair <int,int> p1 = {1,2}; cout<<p1.first<< " "<< p1.second<<endl; pair <int, pair<int ,char>> p2 = {1,{2,'c'}}; cout<<p2.first<<" "<<p2.second.first<<" "<<p2.second.second<<endl; pair <int,int> arr[] = {{2,3},{4,5},{6,7}}; cout...
Find Users With Valid E-Mails || Leetcode sql solution || Easy solution || Fully-Explained || 💯💯💯✅✅✅🔥🔥🔥
- Get link
- X
- Other Apps
1517. Find Users With Valid E-Mails
Write an SQL query to find the users who have valid emails.
A valid e-mail has a prefix name and a domain where:
- 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. - The domain is
'@leetcode.com'
.
Return the result table in any order.
The query result format is in the following example.
Fully-Explained Solution :
To write SQL query for selecting all rows from the Users table where the mail column to match with a regular expression pattern that describes a valid email address with has the domain @leetcode.com.
REGEXP :- It is the sequence of characters that specifies a match pattern in text
Approach :-
The regular expression pattern should contain'^[a-zA-Z][a-zA-Z0-9._-]*@leetcode\\.com'
^
: specifies the starting charater of string[a-zA-Z]
: matches only one upper or lower case letter in this sequence.[a-zA-Z0-9._-]*
: matches zero or more letter of upper or lower case letter, digit, underscore, period, or dash.@leetcode\\.com
: matches the string @leetcode.com, where the backslash is used to escape the period character.
Finally, This SQL query returns all rows from the Users table
- the mail column starts with a letter ^[a-zA-Z],
- followed by zero or more occurrences of letters, digits, underscores, periods, or dashes, [a-zA-Z0-9._-]*
- ends with @leetcode.com , '@leetcode\.com'
This satisfies the condition of a valid email address
SQL Query :-
SELECT *
FROM Users
WHERE mail REGEXP '^[a-zA-Z][a-zA-Z0-9._-]*@leetcode\\.com' ;
Popular posts from this blog
1050. Actors and Directors Who Cooperated At Least Three Times || Leetcode sql solution || Simple and Easy Approach || ✅✅✅✅💯💯💯🔥🔥🔥🔥
Actors and Directors Who Cooperated At Least Three Times || Leetcode sql solution || Simple and Easy Approach || ✅✅✅✅💯💯💯🔥🔥🔥🔥 Link For The Question : Actors and Directors Who Cooperated At Least Three Times SQL SOLUTION : USING GROUP BY: select actor_id , director_id from ( select actor_id , director_id , count ( timestamp ) as cooperated from ActorDirector group by actor_id , director_id ) as table1 where cooperated >= 3 ; GROUP WITH HAVING CLAUSE: select actor_id , director_id from ActorDirector group by actor_id , director_id Having count ( timestamp ) >= 3 ;
Power of Millets || Happy And Healthy Life
Foundation Day Meeting : By D. Anjaneyulu Reddy : Power of millets: When food is right no medicine is needed. When food is wrong no medicine works 1. Cosmetologist : due to unbalanced diet, regularly going to cosmetologist 2. Harmonal imbalance : hair loss 3. 1 gm of sugar / 1 litre of blood : It is good for health. 4. Staple food : It is eaten regularly , large part of person's diet. 5. Don't eat icecream as it increase the sugar content in blood. Embrace meaning : include , hug
AI in Daily Life
Foundation Day Meeting : About AI : AI helps in 1. Climate change 2. Disaster management 3. Autonomous driving, computer vision, health care, finance How AI Language models to be developed : Ethical ai : 1. Fairness 2. Ethics ( moral principles ) 3. Moral system websites 4. Historical data matters most ( based on that large data , ai takes decision ). 5. AI - ML algorithms build and learn from data 6. Regression model (continuous thing). Compas : About Criminal Case Correctional Offender Management Profiling for Alternative Sanctions ( COMPAS ) is a case management and decision support tool developed and owned by Northpointe (now Equivant) used by U.S. courts to assess the likelihood of a defendant becoming a recidivist . Recidivist is the act of a person repeating an undesirable behavior after they have experienced negative consequences of that behavior, or have been trained to extinguish it. ...
Comments
Post a Comment