🚨 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
🚨 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…
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
🧠 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…
🚀 SQL Challenge #14 — The Lift Capacity Problem is LIVE!
You’re given two tables — LIFT and LIFT_PASSENGERS.
Multiple passengers can try to enter the same lift, but the total passenger weight cannot exceed the lift’s capacity.
Your task?
👉 Write an SQL query that returns a comma-separated list of passengers who can fit into each lift without exceeding capacity, ordered by their weight in ascending order.
In this video, I’ll walk you through my entire step-by-step solution in SQL Server, breaking down the logic clearly so you can learn, understand, and apply it in your own interviews 💼
🎥 Watch the full video here:
👉 https://youtu.be/8e-e1xYsgG0
https://youtu.be/8e-e1xYsgG0
💬 Drop your approach in the comments — let’s see how you solved it differently!
👥 Share this with your SQL buddies who love a good challenge.
#SQLChallenge #SQLServer #SQLQuery #SQLInterview #SQLPractice #SQLJunction #LearnSQL
You’re given two tables — LIFT and LIFT_PASSENGERS.
Multiple passengers can try to enter the same lift, but the total passenger weight cannot exceed the lift’s capacity.
Your task?
👉 Write an SQL query that returns a comma-separated list of passengers who can fit into each lift without exceeding capacity, ordered by their weight in ascending order.
In this video, I’ll walk you through my entire step-by-step solution in SQL Server, breaking down the logic clearly so you can learn, understand, and apply it in your own interviews 💼
🎥 Watch the full video here:
👉 https://youtu.be/8e-e1xYsgG0
https://youtu.be/8e-e1xYsgG0
💬 Drop your approach in the comments — let’s see how you solved it differently!
👥 Share this with your SQL buddies who love a good challenge.
#SQLChallenge #SQLServer #SQLQuery #SQLInterview #SQLPractice #SQLJunction #LearnSQL
YouTube
Find Passengers That Can Fit in Each Lift | SQL Interview Question
In this video, we solve an interesting SQL problem that tests your ability to work with aggregations, joins, and string functions.
🧩 Problem Statement:
The relationship between the LIFT and LIFT_PASSENGERS tables is such that multiple passengers can attempt…
🧩 Problem Statement:
The relationship between the LIFT and LIFT_PASSENGERS tables is such that multiple passengers can attempt…
😲 99% of SQL learners struggle with this problem!
You get a
MM, CI, CO (0.5 pts each) CD, CL, CM (1 pt each)
💥 Challenge: Calculate the total points scored by each club using SQL. Sounds simple? Wait till you try it. 😏
Most people miss the key logic 👀
Can you crack it before watching the solution?
🎥 Full breakdown + solution:
👉 SQL Challenge: Calculate Total Club Points | SQL Interview Question Explained
https://youtu.be/V-mMZ4hhhQE
#SQL #SQLChallenge #DataEngineering #SQLInterview #LearnSQL
You get a
Club table where each member earns rewards like:MM, CI, CO (0.5 pts each) CD, CL, CM (1 pt each)
💥 Challenge: Calculate the total points scored by each club using SQL. Sounds simple? Wait till you try it. 😏
Most people miss the key logic 👀
Can you crack it before watching the solution?
🎥 Full breakdown + solution:
👉 SQL Challenge: Calculate Total Club Points | SQL Interview Question Explained
https://youtu.be/V-mMZ4hhhQE
#SQL #SQLChallenge #DataEngineering #SQLInterview #LearnSQL
🚀 New SQL Hard Challenge is LIVE!
Today’s problem looks simple… until you try it 😅
You’re given a table of products and categories — and your task is to swap records inside each category using SQL window functions.
Most people get stuck on the logic 👀
Can YOU figure out the right approach before watching the solution?
🎥 Watch the full video here:
👉 DELOITTE HARD SQL Interview Question in Hindi | Swap records Inversely
https://youtu.be/jOrTXXleDcg
If you’re preparing for SQL interviews or just love brain-teasing SQL problems, this challenge is for you 🔥
#SQL #SQLChallenge #DataEngineering #SQLInterview #PracticeSQL
Today’s problem looks simple… until you try it 😅
You’re given a table of products and categories — and your task is to swap records inside each category using SQL window functions.
Most people get stuck on the logic 👀
Can YOU figure out the right approach before watching the solution?
🎥 Watch the full video here:
👉 DELOITTE HARD SQL Interview Question in Hindi | Swap records Inversely
https://youtu.be/jOrTXXleDcg
If you’re preparing for SQL interviews or just love brain-teasing SQL problems, this challenge is for you 🔥
#SQL #SQLChallenge #DataEngineering #SQLInterview #PracticeSQL
YouTube
DELOITTE HARD SQL Interview Question in Hindi | Swap records Inversely
In this video, we solve a very interesting SQL problem involving window functions and an update operation.
You’re given a Products table with ProductID, Product, and Category.
The task is to swap the ProductIDs of the products within each category using SQL!…
You’re given a Products table with ProductID, Product, and Category.
The task is to swap the ProductIDs of the products within each category using SQL!…
🔥1
🚀 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
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
🚀 It’s LIVE! The SQL Marathon is finally out 🔥
I’ve published a 3-hour SQL + Data Analytics video where I solve 50 real SQL questions using one YouTube Analytics dataset — step by step.
If you’re preparing for:
• SQL interviews
• Data Engineering / Analytics roles
• Real-world SQL problem solving
This video will seriously level you up 💪
👉 Watch here: https://youtu.be/BmhKUI-PGrc
Let me know in the comments — how many questions could you solve on your own? 😄
— SQL Junction 📊
#DataAnalyst #SQLPractice #SQL #YouTube #SQLInterview #DataAnalytics
I’ve published a 3-hour SQL + Data Analytics video where I solve 50 real SQL questions using one YouTube Analytics dataset — step by step.
If you’re preparing for:
• SQL interviews
• Data Engineering / Analytics roles
• Real-world SQL problem solving
This video will seriously level you up 💪
👉 Watch here: https://youtu.be/BmhKUI-PGrc
Let me know in the comments — how many questions could you solve on your own? 😄
— SQL Junction 📊
#DataAnalyst #SQLPractice #SQL #YouTube #SQLInterview #DataAnalytics
YouTube
YouTube Data Analytics Project: 50 SQL Interview Questions Solved | 3 Hour SQL Marathon
In this 3-hour SQL marathon, I solve 50+ real SQL interview questions using ONE realistic YouTube Analytics dataset — step by step, from basics to advanced analytics.
This video is perfect if you’re:
1) Preparing for SQL interviews
2) Learning Data Engineering…
This video is perfect if you’re:
1) Preparing for SQL interviews
2) Learning Data Engineering…
🔥3
🧠 Amazon SQL Interview Challenge
This is an interesting challenge ,please take a look
Ever tried applying Pythagoras theorem in SQL? 😄
You’re given triangle sides stored row-wise and your task is to identify which CombinationID forms a right-angled triangle.
📐 Rule to apply:
H² = P² + B² (longest side matters!)
If this showed up in an interview, how would you approach it?
https://www.linkedin.com/posts/adityabansal095_sql-amazon-amazoninterview-activity-7422150064292282368-fT9O
#SQL #SQLInterview #AmazonInterview #DataEngineering #Analytics #SQLChallenge
This is an interesting challenge ,please take a look
Ever tried applying Pythagoras theorem in SQL? 😄
You’re given triangle sides stored row-wise and your task is to identify which CombinationID forms a right-angled triangle.
📐 Rule to apply:
H² = P² + B² (longest side matters!)
If this showed up in an interview, how would you approach it?
https://www.linkedin.com/posts/adityabansal095_sql-amazon-amazoninterview-activity-7422150064292282368-fT9O
#SQL #SQLInterview #AmazonInterview #DataEngineering #Analytics #SQLChallenge
🎯 Data Engineering Interview in 30 Days? Here’s the Game Plan.
If I had an interview next month, this is exactly how I’d prepare 👇
🧠 Strengthen the Basics
• Revise core SQL concepts
• Solve 20–30 recent SQL questions
• Practice 20–30 Python coding problems
⚡ Spark & Big Data
• Understand PySpark fundamentals
• RDDs vs DataFrames vs Datasets
• Practice top PySpark programs
🏗 Data Engineering Foundations
• Revise Data Warehousing concepts
• Understand your project’s data model
• Review cloud services used
💻 Practical Knowledge
• Essential Linux commands
• Be ready to explain your project clearly
• Know your roles & responsibilities
• Understand implementation details
📚 Interview Readiness
• Common DE interview questions
• Read interview experiences of the target company
💡 30 days is more than enough — if you prepare with focus.
Start today. Small daily effort > last week panic 🚀
#dataengineer #jobopportunity #learning #interview #SQLInterview
If I had an interview next month, this is exactly how I’d prepare 👇
🧠 Strengthen the Basics
• Revise core SQL concepts
• Solve 20–30 recent SQL questions
• Practice 20–30 Python coding problems
⚡ Spark & Big Data
• Understand PySpark fundamentals
• RDDs vs DataFrames vs Datasets
• Practice top PySpark programs
🏗 Data Engineering Foundations
• Revise Data Warehousing concepts
• Understand your project’s data model
• Review cloud services used
💻 Practical Knowledge
• Essential Linux commands
• Be ready to explain your project clearly
• Know your roles & responsibilities
• Understand implementation details
📚 Interview Readiness
• Common DE interview questions
• Read interview experiences of the target company
💡 30 days is more than enough — if you prepare with focus.
Start today. Small daily effort > last week panic 🚀
#dataengineer #jobopportunity #learning #interview #SQLInterview
❤5
🚨 Quick SQL Reality Check
Most developers think:
COUNT(*) = COUNT(Column)
But that’s not always true 👀
A single NULL value can completely change the result.
I recorded a quick 30-second Short explaining the difference with a simple example.
🎥 Watch here:
👉 [Paste YouTube Shorts Link]
Trust me, this is one concept worth remembering for SQL interviews and real-world projects.
Or, if you want something more aggressive:
⚠️ SQL Interview Trap
What will these return?
COUNT(*)
COUNT(Salary)
Same answer? 🤔
Most people get this wrong because of NULL values.
I explained it in a quick YouTube Short👇
🎥 Watch Now:
👉
https://youtube.com/shorts/1rHHZmMHx6E?feature=share
Did you know the answer before watching? 😏
Most developers think:
COUNT(*) = COUNT(Column)
But that’s not always true 👀
A single NULL value can completely change the result.
I recorded a quick 30-second Short explaining the difference with a simple example.
🎥 Watch here:
👉 [Paste YouTube Shorts Link]
Trust me, this is one concept worth remembering for SQL interviews and real-world projects.
Or, if you want something more aggressive:
⚠️ SQL Interview Trap
What will these return?
COUNT(*)
COUNT(Salary)
Same answer? 🤔
Most people get this wrong because of NULL values.
I explained it in a quick YouTube Short👇
🎥 Watch Now:
👉
https://youtube.com/shorts/1rHHZmMHx6E?feature=share
Did you know the answer before watching? 😏
❤1
🚨 New SQL Shorts Alert! 🚨
Can you solve this Deloitte SQL Interview Question? 👀
🎯 Find all employees who earn more than their manager.
Sounds simple… until you actually try writing the query 😏
I’ve explained the complete logic in a quick 30-second YouTube Short.
🎥 Watch now:
👉 Deloitte SQL Interview Question 🤯 | Employees Earning More Than Their Manager#sqlinterview#deloitte
https://youtube.com/shorts/D98qCDNnSdw?feature=share
Drop a 🔥 if you got the answer right before watching!
Can you solve this Deloitte SQL Interview Question? 👀
🎯 Find all employees who earn more than their manager.
Sounds simple… until you actually try writing the query 😏
I’ve explained the complete logic in a quick 30-second YouTube Short.
🎥 Watch now:
👉 Deloitte SQL Interview Question 🤯 | Employees Earning More Than Their Manager#sqlinterview#deloitte
https://youtube.com/shorts/D98qCDNnSdw?feature=share
Drop a 🔥 if you got the answer right before watching!
YouTube
Deloitte SQL Interview Question 🤯 | Employees Earning More Than Their Manager#sqlinterview#deloitte
🚨 SQL Interview Challenge 🚨Can you find all employees who earn mo...
👍1
🔥 New YouTube Video Alert
Can You Solve This Deloitte SQL Interview Question?
You’re given a products table where the category is available only for the first product, while the following rows contain NULL.
🎯 Challenge:
How would you fill those NULL category values with the correct category?
💡 Hint: Think about Window Functions 👀
This is a great SQL problem to test your understanding of NULL handling + data transformation.
👇 What would you use?
🅰️ LAG()
🅱️ LEAD()
🅲️ LAST_VALUE()
🅳️ ROW_NUMBER()
🎬 Solution video
Fill Missing Categories in SQL | Hard Deloitte Interview Question
https://youtu.be/IX9NBK3Yx-M
🚀
Check it out now and let me know in comments ,What did you learn?
#SQL #SQLInterview #Deloitte #SQLChallenge #DataEngineering #Snowflake
Can You Solve This Deloitte SQL Interview Question?
You’re given a products table where the category is available only for the first product, while the following rows contain NULL.
Beverages → Coca ColaNULL → PepsiNULL → SpriteNULL → FantaSnacks → LaysNULL → DoritosNULL → Kurkure🎯 Challenge:
How would you fill those NULL category values with the correct category?
💡 Hint: Think about Window Functions 👀
This is a great SQL problem to test your understanding of NULL handling + data transformation.
👇 What would you use?
🅰️ LAG()
🅱️ LEAD()
🅲️ LAST_VALUE()
🅳️ ROW_NUMBER()
🎬 Solution video
Fill Missing Categories in SQL | Hard Deloitte Interview Question
https://youtu.be/IX9NBK3Yx-M
🚀
Check it out now and let me know in comments ,What did you learn?
#SQL #SQLInterview #Deloitte #SQLChallenge #DataEngineering #Snowflake
YouTube
Fill Missing Categories in SQL | Hard Deloitte Interview Question
In this SQL interview question, we have a product table where the category is available for the first product but appears as NULL for the following products.
🎯 The challenge:
Fill the missing category values by carrying forward the last non-NULL category…
🎯 The challenge:
Fill the missing category values by carrying forward the last non-NULL category…
👍1