Top SQL Interview Questions and Answers | 30 Days SQL Challenge |SQL Tutorials |Microsoft - #03/30

preview_player
Показать описание
📁 Get the code:

Get all my latest SQL project!
🎯 Get Latest SQL Guided Project (1M sales records)

🎯 Get Latest
End to End Advanced SQL Project (Amazon)+ 70 Business Problems

🐍 All Python Projects:
Python ETL - Data Cleaning Project

🛢All SQL Projects
Project 1:

Project 2:

Project 3: (Advanced SQL)
🎯 Zomato Food Company Data Analysis

Project 4:
🎯 Netflix Movies Data Analysis

Project 5:
🎯 Amazon Sales Analysis (Advanced SQL)

Project 6:
🎯 Spotify Data Analysis

Project 7: (Advanced SQL)
🎯 Apple Retail Sales Analysis - 1M Sales Records

Project 8: (Real Business Problems)
🎯 Monday Coffee Extensions Analysis

Best Data Analytics Course:

My Other YouTube Videos -
SQL 30 Days Road Map - [Free Learning Resources]

Ready to CRUSH your Data Analyst or Business Analyst interview? Join me on this 30-DAY SQL INTERVIEW CHALLENGE!

In this video, we'll dive DEEP into an ACTUAL Interview Question for Business Analyst and Data Analyst interview question. I'll walk you through:

Understanding the problem statement: We'll break down the question clearly and identify key requirements.
Building the optimal SQL query: Step-by-step, we'll craft an efficient and accurate solution using JOINs, aggregations, and filters.
Explaining your thought process: Learn how to articulate your problem-solving approach and showcase your SQL expertise.
BONUS TIPS & TRICKS: Gain valuable insights for acing your SQL interview with confidence.
Don't forget to:

Like this video and subscribe for more daily challenge videos!
Leave a comment with your own approach to the question.
Share this video with your fellow job seekers!
This is just the beginning! Subscribe now and stay tuned for Day 2's challenge!
Рекомендации по теме
Комментарии
Автор

;with cte_salaries as
(
select
emp_name, department, salary, dense_rank() over (partition by department order by salary desc) as drnk
from salaries
where department in ('Engineering', 'Marketing')
)
select
ABS(MAX(salary) - MIN(salary)) as salary_diff
from cte_salaries where drnk = 1


;with cte_salary as
(
select
MAX(case when department = 'Engineering' then salary end) as engineering_salary,
MAX(case when department = 'Marketing' then salary end) as marketing_salary
from Salaries
)
select abs(engineering_salary - marketing_salary) as salary_diff from cte_salary

madhusudhanreddyt
Автор

bro plss try to show from starting what values u entered, what data types and constraints u used
cause we ppl can make exact same and make queries on it...

syedumair
Автор

bro plss try to show from starting what values u entered, what data types and constraints u used As specially conatraints

anandaglave
Автор

Could you please explain why you put count(1) instead of count(message_id)?

ANEETAMARY-kf
Автор

Solution with CTE
WITH cte AS(
SELECT salary, RANK() OVER(PARTITION BY department ORDER BY salary DESC) AS rk FROM Salaries
)
SELECT (MAX(salary) - MIN(salary)) AS Salary_diff FROM cte WHERE rk = 1;

akshayjain
Автор

What we can do we can solve this que through row_number
SELECT *
FROM (
SELECT
SUM(salary) AS highest_salary , department,
ROW_NUMBER() OVER(PARTITION BY department ORDER BY salary DESC) AS rn
FROM table_name) x
WHERE rn = 1

hskvlogbhyi
join shbcf.ru