๐จ SQL Challenge โ Real-World Use Case
Youโre given a log table with 3 columns:
๐
๐ฆ
๐ค
Task:
๐ For each account, identify users who came back after 7+ days of inactivity.
Sounds simple, right?
But to solve this, youโll need to:
* Use
* Calculate gaps between logins per user
* Filter only those who returned after 7+ days
* Do all of this per account, not globally
This is exactly the kind of logic youโll face in interviews and real projects.
Hereโs the SQL solution ๐
๐ง SQL Solution:
WITH user_logins AS (
SELECT
account_id,
user_id,
record_date,
LAG(record_date) OVER (
PARTITION BY account_id, user_id
ORDER BY record_date
) AS prev_login
FROM user_activity_log
),
login_gaps AS (
SELECT *,
DATEDIFF(day, prev_login, record_date) AS gap_days
FROM user_logins
)
SELECT DISTINCT
account_id,
user_id
FROM login_gaps
WHERE gap_days >= 7;
๐ฉ For more such real-world SQL questions?
Join the LinkedIn posts and weekly YouTube drops:
๐ https://www.youtube.com/playlist?list=PLU1HobJd_JCqjcZwUCc6s8avJutoIjyIF
๐ Stay tuned here for more!
#SQL #DataEngineering #InterviewPrep #SQLInterview
Youโre given a log table with 3 columns:
๐
record_date,๐ฆ
account_id,๐ค
user_idTask:
๐ For each account, identify users who came back after 7+ days of inactivity.
Sounds simple, right?
But to solve this, youโll need to:
* Use
LAG() to compare login dates* Calculate gaps between logins per user
* Filter only those who returned after 7+ days
* Do all of this per account, not globally
This is exactly the kind of logic youโll face in interviews and real projects.
Hereโs the SQL solution ๐
๐ง SQL Solution:
WITH user_logins AS (
SELECT
account_id,
user_id,
record_date,
LAG(record_date) OVER (
PARTITION BY account_id, user_id
ORDER BY record_date
) AS prev_login
FROM user_activity_log
),
login_gaps AS (
SELECT *,
DATEDIFF(day, prev_login, record_date) AS gap_days
FROM user_logins
)
SELECT DISTINCT
account_id,
user_id
FROM login_gaps
WHERE gap_days >= 7;
๐ฉ For more such real-world SQL questions?
Join the LinkedIn posts and weekly YouTube drops:
๐ https://www.youtube.com/playlist?list=PLU1HobJd_JCqjcZwUCc6s8avJutoIjyIF
๐ Stay tuned here for more!
#SQL #DataEngineering #InterviewPrep #SQLInterview
YouTube
SQL Complex interview questions
Share your videos with friends, family, and the world
๐จ Netflix SQL Interview Question Alert!
They asked this in an actual interview:
๐ฌ "Find the genre of the person with the most Oscar winsโฆ and join using names, not IDs."
Sounds simple? Itโs not.
Real-world SQL. Real logic. Real fun. ๐
I just posted a breakdown on LinkedIn โ check it out and drop a โNetflix ๐ฅโ to get the full solution!
๐ https://www.linkedin.com/posts/adityabansal095_sql-dataanalytics-sqlinterview-activity-7343592162338422785-OsV9?utm_source=share&utm_medium=member_desktop&rcm=ACoAAB8c2Z8Bcu4nHPJW24bZAavnMChCO7Q0wCQ
#SQL #Netflix #SQLJunction #DataEngineering #InterviewPrep
They asked this in an actual interview:
๐ฌ "Find the genre of the person with the most Oscar winsโฆ and join using names, not IDs."
Sounds simple? Itโs not.
Real-world SQL. Real logic. Real fun. ๐
I just posted a breakdown on LinkedIn โ check it out and drop a โNetflix ๐ฅโ to get the full solution!
๐ https://www.linkedin.com/posts/adityabansal095_sql-dataanalytics-sqlinterview-activity-7343592162338422785-OsV9?utm_source=share&utm_medium=member_desktop&rcm=ACoAAB8c2Z8Bcu4nHPJW24bZAavnMChCO7Q0wCQ
#SQL #Netflix #SQLJunction #DataEngineering #InterviewPrep
Linkedin
#sql #dataanalytics #sqlinterview #datascience #database #sqlquery #techinterview #dataengineering #learnsql #bigdata #datajobsโฆ
Dear Data Enthusiasts,
๐ฌ Netflix interview questions arenโt just cool โ theyโre designed to mess with your head (in a good way) ๐ฌ
๐ก๐๐ฎ๐๐ฌ๐ญ๐ข๐จ๐ง:
Find the genre of the person with the most Oscar wins.
If there's a tie, return the genre of the person whoseโฆ
๐ฌ Netflix interview questions arenโt just cool โ theyโre designed to mess with your head (in a good way) ๐ฌ
๐ก๐๐ฎ๐๐ฌ๐ญ๐ข๐จ๐ง:
Find the genre of the person with the most Oscar wins.
If there's a tie, return the genre of the person whoseโฆ
๐จ New Video Just Dropped!
๐บ Just uploaded a fresh YouTube video where I break down a Hard Google SQL interview question:
๐ฌ Compare the rating of an actorโs most recent film with the average of all their previous films.
If youโre preparing for SQL interviews or just want to level up your logic โ this is a must-watch!
๐ Watch here: https://youtu.be/gZ7ZKtKvL7s
๐ฅ Donโt forget to like, comment, and share if it helps!
Please help me in reaching 500 subscribers, Guys!!
#SQLJunction #SQLInterview #Google #DataEngineering #InterviewPrep #DataJobs
๐บ Just uploaded a fresh YouTube video where I break down a Hard Google SQL interview question:
๐ฌ Compare the rating of an actorโs most recent film with the average of all their previous films.
If youโre preparing for SQL interviews or just want to level up your logic โ this is a must-watch!
๐ Watch here: https://youtu.be/gZ7ZKtKvL7s
๐ฅ Donโt forget to like, comment, and share if it helps!
Please help me in reaching 500 subscribers, Guys!!
#SQLJunction #SQLInterview #Google #DataEngineering #InterviewPrep #DataJobs
YouTube
Google SQL Interview Question | Calculate Actor Latest VS Average Film Ratings ๐ฅ
๐ฌ Google SQL Interview Question โ Most Recent Film vs Average Rating Explained!
In this video, I break down a real SQL question asked in a Google interview:
๐ For each actor, calculate the difference between the rating of their most recent film and theirโฆ
In this video, I break down a real SQL question asked in a Google interview:
๐ For each actor, calculate the difference between the rating of their most recent film and theirโฆ
๐จ SQL Interview Prep Kit ๐จ
1๏ธโฃ Aggregations
2๏ธโฃ Window Functions
3๏ธโฃ Set Operators
4๏ธโฃ Indexing for Performance
5๏ธโฃ SQL for Analytics
๐ฏ Perfect for quick revision before interviews or weekend practice!
#SQL #InterviewPrep #DataEngineering #SQLJunction
1๏ธโฃ Aggregations
2๏ธโฃ Window Functions
3๏ธโฃ Set Operators
4๏ธโฃ Indexing for Performance
5๏ธโฃ SQL for Analytics
๐ฏ Perfect for quick revision before interviews or weekend practice!
#SQL #InterviewPrep #DataEngineering #SQLJunction
Average SQL vs Great SQL.pdf
169.7 KB
๐ซ Most developers write SQL like this...
โ But great developers write it like this.
Just shared a visual breakdown of common SQL mistakes โ and how to fix them like a pro! โก
Perfect for anyone preparing for interviews or writing SQL daily.
๐ Upgrade your query game in 60 seconds.
#SQL #InterviewPrep #SQLTips #SQLJunction #SQLInterview
โ But great developers write it like this.
Just shared a visual breakdown of common SQL mistakes โ and how to fix them like a pro! โก
Perfect for anyone preparing for interviews or writing SQL daily.
๐ Upgrade your query game in 60 seconds.
#SQL #InterviewPrep #SQLTips #SQLJunction #SQLInterview
โค2
๐ SQL Interview Trick You Must Know!
Just dropped a brand new video ๐ฅ
๐ Problem: Forward fill
๐ง Covered: A smart use of
If you're preparing for SQL/Data Engineering interviews, this is the kind of trick that separates good from great ๐
Donโt miss this one!
๐บ Watch now: https://youtu.be/sBcMQfyb4eU?si=xPgvTcMOdSvAudSx
#SQL #InterviewPrep #DataEngineering #SQLTricks
Just dropped a brand new video ๐ฅ
๐ Problem: Forward fill
NULL values with the last non-null value in a SQL table.๐ง Covered: A smart use of
FIRST_VALUE() and logic building that actually makes sense!If you're preparing for SQL/Data Engineering interviews, this is the kind of trick that separates good from great ๐
Donโt miss this one!
๐บ Watch now: https://youtu.be/sBcMQfyb4eU?si=xPgvTcMOdSvAudSx
#SQL #InterviewPrep #DataEngineering #SQLTricks
YouTube
Forward Fill NULLs using FIRST_VALUE() | This SQL Interview Trick Blew My Mind ๐คฏ | SQL Interview
๐ฅ SQL Interview Favorite โ Forward Fill NULLs Like a Pro!
Have you ever been asked to forward fill `NULL` values in SQL with the last non-NULL value?
This is a classic data engineering interview question โ and many folks get stuck here!
๐จโ๐ป Problem:
You'reโฆ
Have you ever been asked to forward fill `NULL` values in SQL with the last non-NULL value?
This is a classic data engineering interview question โ and many folks get stuck here!
๐จโ๐ป Problem:
You'reโฆ
๐ง This complex SQL question from Google looked simpleโฆ until I actually started solving it.
Letโs just say โ a plain
I used a mix of aggregates + window functions to crack it โ and the approach might surprise you.
๐ฅ https://youtu.be/Qvudg-uYwk0?si=IQnB_HofAvXg21oy
#SQL #InterviewPrep #SQLInterview #DataEngineering
Letโs just say โ a plain
JOIN wasnโt enough. ๐I used a mix of aggregates + window functions to crack it โ and the approach might surprise you.
๐ฅ https://youtu.be/Qvudg-uYwk0?si=IQnB_HofAvXg21oy
#SQL #InterviewPrep #SQLInterview #DataEngineering
YouTube
SQL Server Complex Interview Question | Find number of flags for videos reviewed by Youtube
๐ SQL Interview Question | Google SQL Challenge | Window Functions Explained
In this video, I solve a real SQL interview question asked in Google from the StrataScratch platform.
Weโll walk through the problem step-by-step, understand the requirements, andโฆ
In this video, I solve a real SQL interview question asked in Google from the StrataScratch platform.
Weโll walk through the problem step-by-step, understand the requirements, andโฆ
๐ Just shared a super useful post for anyone preparing for Data Analyst roles โ especially Deloitte!
I broke down a fresh interview experience covering: โข SQL scenario-based questions โข Power BI practical problems โข Behavioral questions you
should be ready for
If you're aiming for Deloitte or any top-tier data role, this will give you a clear idea of what to expect ๐
https://www.linkedin.com/posts/adityabansal095_deloitte-deloitteinterview-big4interviews-activity-7399760164922388480-DjaP?utm_source=share&utm_medium=member_ios&rcm=ACoAAB8c2Z8Bcu4nHPJW24bZAavnMChCO7Q0wCQ
#SQL #DataAnalyst #PowerBI #InterviewPrep
I broke down a fresh interview experience covering: โข SQL scenario-based questions โข Power BI practical problems โข Behavioral questions you
should be ready for
If you're aiming for Deloitte or any top-tier data role, this will give you a clear idea of what to expect ๐
https://www.linkedin.com/posts/adityabansal095_deloitte-deloitteinterview-big4interviews-activity-7399760164922388480-DjaP?utm_source=share&utm_medium=member_ios&rcm=ACoAAB8c2Z8Bcu4nHPJW24bZAavnMChCO7Q0wCQ
#SQL #DataAnalyst #PowerBI #InterviewPrep
โค2
๐ฏ New SQL Interview Question on YouTube!
A real Deloitte Interview Question that tests: โข Window functions โข Logical thinking under pressure โข Your ability to connect dates correctly ๐ โ๏ธ
DELOITTE HARD SQL Interview Question in Hindi | Find Start and End Dates for Consecutive rows
https://youtu.be/ZPcV0OmSaIo
Most candidates struggle hereโฆ Can YOU solve it? ๐ค
Watch now ๐
๐ฅ
#SQL #InterviewPrep #DataEngineering #LearnSQL #SQLServer #Programming #SQLPractice #TechInterview #YouTubeChannel #SQLCommunity #SQLJunction #AdityaBansal
A real Deloitte Interview Question that tests: โข Window functions โข Logical thinking under pressure โข Your ability to connect dates correctly ๐ โ๏ธ
DELOITTE HARD SQL Interview Question in Hindi | Find Start and End Dates for Consecutive rows
https://youtu.be/ZPcV0OmSaIo
Most candidates struggle hereโฆ Can YOU solve it? ๐ค
Watch now ๐
๐ฅ
#SQL #InterviewPrep #DataEngineering #LearnSQL #SQLServer #Programming #SQLPractice #TechInterview #YouTubeChannel #SQLCommunity #SQLJunction #AdityaBansal
YouTube
DELOITTE HARD SQL Interview Question in Hindi | Find Start and End Dates for Consecutive rows
๐ฏ SQL Interview Challenge โ Can You Solve This?
In this video, we take a real-world problem involving event logs and use SQL window functions (ROW_NUMBER) to group consecutive records by date. This is a popular interview question used in top tech and dataโฆ
In this video, we take a real-world problem involving event logs and use SQL window functions (ROW_NUMBER) to group consecutive records by date. This is a popular interview question used in top tech and dataโฆ
๐ SQL SET Operators: The Quick Guide ๐
Stop trying to solve everything with JOINs! If you need to combine data vertically, these are your best friends:
๐น UNION Combines results and removes duplicates. Perfect for a clean, unique list. ๐งน
๐น UNION ALL Combines everything, including duplicates. It's much faster because the DB doesn't have to scan for duplicates! โก๏ธ
๐น INTERSECT Finds the common ground. Only returns rows that exist in both datasets. ๐ค
๐น EXCEPT / MINUS The "difference" finder. Shows what's in your first query but NOT in the second. ๐ซ
๐ก Pro-Tip for Interviews: Always remember: For SET operators to work, your queries must have the same number of columns and matching data types!
https://www.linkedin.com/posts/adityabansal095_i-used-to-think-sql-joins-were-the-only-way-share-7414127739210797057-plAi
#SQL #DataScience #Database #CodingTips #DataAnalytics #InterviewPrep #TechSkills #SQLServer
Stop trying to solve everything with JOINs! If you need to combine data vertically, these are your best friends:
๐น UNION Combines results and removes duplicates. Perfect for a clean, unique list. ๐งน
๐น UNION ALL Combines everything, including duplicates. It's much faster because the DB doesn't have to scan for duplicates! โก๏ธ
๐น INTERSECT Finds the common ground. Only returns rows that exist in both datasets. ๐ค
๐น EXCEPT / MINUS The "difference" finder. Shows what's in your first query but NOT in the second. ๐ซ
๐ก Pro-Tip for Interviews: Always remember: For SET operators to work, your queries must have the same number of columns and matching data types!
https://www.linkedin.com/posts/adityabansal095_i-used-to-think-sql-joins-were-the-only-way-share-7414127739210797057-plAi
#SQL #DataScience #Database #CodingTips #DataAnalytics #InterviewPrep #TechSkills #SQLServer
FAANG SQL Challenge: Can you solve "The Delimiter Trap"? ๐งฉ
I just dropped a new breakdown of a classic interview problem that trips up even Senior Data Engineers.
The Task: Extract and calculate reward points from a single "messy" column (e.g., `'MM:CI:CD'`).
Why you should watch:
โ Learn the cleanest way to use
โ Master Conditional Aggregation (no more spaghetti code!).
โ Avoid the #1 over-engineering mistake candidates make in FAANG interviews.
Stop struggling with messy dataโmaster the logic in 5 minutes.
Watch the full solution here:
๐๐๐
https://youtu.be/Pg5F8_ViXE8
Which one is faster for thisโ`STRING_SPLIT` or
#SQL #InterviewPrep #DataEngineering #SQLJunction #SQLInterview
I just dropped a new breakdown of a classic interview problem that trips up even Senior Data Engineers.
The Task: Extract and calculate reward points from a single "messy" column (e.g., `'MM:CI:CD'`).
Why you should watch:
โ Learn the cleanest way to use
STRING_SPLIT.โ Master Conditional Aggregation (no more spaghetti code!).
โ Avoid the #1 over-engineering mistake candidates make in FAANG interviews.
Stop struggling with messy dataโmaster the logic in 5 minutes.
Watch the full solution here:
๐๐๐
https://youtu.be/Pg5F8_ViXE8
Which one is faster for thisโ`STRING_SPLIT` or
CROSS APPLY? Let me know in the YouTube comments! ๐#SQL #InterviewPrep #DataEngineering #SQLJunction #SQLInterview
YouTube
FAANG SQL Interview Challenge | Calculate Total Club Points
๐ฏ SQL Challenge โ Can You Solve This?
In this video, weโll solve a real SQL interview-style problem involving reward points and club memberships.
Table Create Statements:
Create Table Club (
Club_Id int,
Member_Id int,
EDU varchar(30))
Insert into Clubโฆ
In this video, weโll solve a real SQL interview-style problem involving reward points and club memberships.
Table Create Statements:
Create Table Club (
Club_Id int,
Member_Id int,
EDU varchar(30))
Insert into Clubโฆ
๐1
Top Data Analyst Projects That Impress Recruiters ๐๐ผ
1. Sales Data Analysis
โ Analyze monthly/quarterly sales trends
โ Segment by product, region, and sales reps
โ Tools: Excel, SQL, Power BI/Tableau
2. Customer Retention Dashboard
โ Churn analysis and retention KPIs
โ Use cohort analysis, funnel visualization
โ Tools: Python, Tableau
3. E-commerce Data Exploration
โ Study user behavior, conversion rate
โ Analyze cart abandonment, top-selling products
โ Tools: SQL, Python (Pandas, Matplotlib)
4. HR Data Insights
โ Track hiring trends, attrition, diversity metrics
โ Build dashboards showing tenure, department stats
โ Tools: Excel, Power BI
5. Financial Data Modeling
โ Actual vs. forecasted revenue/costs
โ Include profitability ratios and variance analysis
โ Tools: Excel, Power BI, SQL
6. Web Traffic Analysis
โ Analyze Google Analytics or log data
โ Focus on user paths, bounce rates, session duration
โ Tools: Python, SQL
7. Survey Data Insights
โ Clean raw survey data, visualize trends
โ Sentiment analysis on feedback (optional NLP)
โ Tools: Excel, Python, Tableau
Tips:
โข Explain the business impact of your insights
โข Show your workflow: data cleaning โ analysis โ visualization
โข Host projects on GitHub or portfolio site
Stay Tunedโค๏ธ๐
#Dataanalyst #SQL #InterviewPrep
1. Sales Data Analysis
โ Analyze monthly/quarterly sales trends
โ Segment by product, region, and sales reps
โ Tools: Excel, SQL, Power BI/Tableau
2. Customer Retention Dashboard
โ Churn analysis and retention KPIs
โ Use cohort analysis, funnel visualization
โ Tools: Python, Tableau
3. E-commerce Data Exploration
โ Study user behavior, conversion rate
โ Analyze cart abandonment, top-selling products
โ Tools: SQL, Python (Pandas, Matplotlib)
4. HR Data Insights
โ Track hiring trends, attrition, diversity metrics
โ Build dashboards showing tenure, department stats
โ Tools: Excel, Power BI
5. Financial Data Modeling
โ Actual vs. forecasted revenue/costs
โ Include profitability ratios and variance analysis
โ Tools: Excel, Power BI, SQL
6. Web Traffic Analysis
โ Analyze Google Analytics or log data
โ Focus on user paths, bounce rates, session duration
โ Tools: Python, SQL
7. Survey Data Insights
โ Clean raw survey data, visualize trends
โ Sentiment analysis on feedback (optional NLP)
โ Tools: Excel, Python, Tableau
Tips:
โข Explain the business impact of your insights
โข Show your workflow: data cleaning โ analysis โ visualization
โข Host projects on GitHub or portfolio site
Stay Tunedโค๏ธ๐
#Dataanalyst #SQL #InterviewPrep
โค1