SQL Mock Interview (Data Analyst): Departments with the Highest Revenues

  Рет қаралды 35,889

Exponent

Exponent

Күн бұрын

Don't leave your SQL interviews to chance. Sign up for Exponent's SQL interview course today: bit.ly/3TYla1W
In this video, we dive into advanced SQL topics by analyzing and solving 5 real-world business problems in a SQL mock interview. We'll cover joins, grouping, aggregations, CTEs, sub-queries, and window functions. The problems include finding department revenue, tracking user orders, analyzing customer orders, selecting the second-highest order amount, and discovering the highest month-over-month increase in order amount.
Chapters (Powered by ChapterMe) -
00:00 - Introduction to SQL for Analyzing Orders and Revenue
02:23 - Basics of Data Retrieval and Simple Filtering in SQL
03:22 - Advanced SQL Techniques: Joining Tables and Filtering Data
06:02 - Detailed Analysis: Order Breakdown by Department for 2020
12:34 - Utilizing Inner Joins to Enhance Data Accuracy
14:45 - Applying Time Constraints to Queries for Precise Data Analysis
18:48 - SQL Query Testing for Accuracy and Efficiency
23:17 - Advanced Data Grouping and Aggregation Techniques
27:51 - Identifying Key Insights: Ranking and Sorting Data
33:25 - Analyzing Monthly Trends and Departmental Performance
45:09 - Final Thoughts on SQL Query Optimization and Interview Strategies
50:44 - Conclusion and Reflections on SQL for Data Analysis
Want more SQL content?
- Analyze a User's Posts: • Analyze a User's Posts...
- Find employees who earn more than their managers: • SQL Mock Interview: Fi...
- Analyze Marketing Channels: • Data Science SQL Mock ...
- SQL vs. NoSQL Explained (in 4 Minutes): • SQL vs. NoSQL Explaine...
👉 Subscribe to our channel: bit.ly/exponentyt
🕊️ Follow us on Twitter: bit.ly/exptweet
💙 Like us on Facebook for special discounts: bit.ly/exponentfb
📷 Check us out on Instagram: bit.ly/exponentig
📹 Watch us on TikTok: bit.ly/exponenttikttok
ABOUT US:
Did you enjoy this interview question and answer? Want to land your dream career? Exponent is an online community, course, and coaching platform to help you ace your upcoming interview. Exponent has helped people land their dream careers at companies like Google, Microsoft, Amazon, and high-growth startups. Exponent is currently licensed by Stanford, Yale, UW, and others.
Our courses include interview lessons, questions, and complete answers with video walkthroughs. Access hours of real interview videos, where we analyze what went right or wrong, and our 1000+ community of expert coaches and industry professionals, to help you get your dream job and more!
#sql #sqlinterview #datascience #businessanalyst

Пікірлер: 25
@tryexponent
@tryexponent 4 ай бұрын
Don't leave your SQL interviews to chance. Sign up for Exponent's SQL interview course today: bit.ly/3TYla1W
@kaboyodaniel3630
@kaboyodaniel3630 11 ай бұрын
Thanks for all you do. Always a joy to follow along. Wish there was more videos like this.
@sem1246
@sem1246 Жыл бұрын
thanks for the video, it's really useful
@Alpha408
@Alpha408 9 ай бұрын
Thanks a million for this work, highly appreciated as i'll be applying for data positions at the end of the year. Quick observation; The cte in the third query was not used, cte = orders_per_year . And the rank was not also used either
@prateeksenapati2152
@prateeksenapati2152 Жыл бұрын
For the question on "second highest order amount in the fashion department", should we be using DENSE_RANK() instead of RANK() - since if 2 orders have the highest amount then the third order (which is the second highest amount order) will get a rank of 3 using RANK() and a rank of 2 using DENSE_RANK()?
@funtik_777
@funtik_777 7 ай бұрын
where o.order_date in (2019 etc) should not give expected result. Need to use year(o.order_date) in(2019,2020 etc
@pakalupapito3202
@pakalupapito3202 Ай бұрын
Landed my data analyst job thanks
@tryexponent
@tryexponent Ай бұрын
Congrats!! 🎉
@angkhoi6111
@angkhoi6111 Ай бұрын
thanks for all
@mohammadnasser9951
@mohammadnasser9951 7 ай бұрын
at 27:27 do we really need to group by c.first_name and c.last_name? I mean we already grouping by c.customer_id which has a kind of one-to-one relation with the first and last name
@user-jq3iy7td9w
@user-jq3iy7td9w 2 ай бұрын
hello! i would like get to know such information like: this interview is for what level, for instance, junior or middle, maybe senior?
@nilsaha8021
@nilsaha8021 Ай бұрын
I did not understand the code of the last question. He had to calculate the increase or decrease in month-over-month growth for the year 2022. What was the basis for creating the CTE for November and December (hardcoded)? In the second CTE, he filtered out only the December amount. Does it calculate and compare all the data back to January?
@dickyalamsyah790
@dickyalamsyah790 6 ай бұрын
You can’t group by within rank function actually
@aliaksandrmatrunich2056
@aliaksandrmatrunich2056 6 ай бұрын
order_date>= YEAR(CURRENT_DATE - INTERVAL 5 YEAR);
@user-qe2tc4mw8q
@user-qe2tc4mw8q 10 ай бұрын
w7.w3 wrong to group by customer and year,.. it should be only group by customer.
@asceticadarsh8284
@asceticadarsh8284 2 ай бұрын
27:51 Mistake CTE order_rankings have mention but in query orders_ranked
@newenglandnomad9405
@newenglandnomad9405 10 ай бұрын
Is this query something you'd actually be asked to write on the job?
@tryexponent
@tryexponent 10 ай бұрын
Hey newenglandnomad9405! The complexity of queries you'll write on the job can vary depending on the role, department, and company. In many cases, you'll have the support of senior colleagues and prior discussions to guide you. Technical interviews typically focus on standard topics and concepts relevant to the job, like SQL for data science or data structures for software engineering. These questions aim to assess the candidates' technical foundations, even if the skills might not be directly used in their day-to-day tasks. So, while you may encounter similar queries in interviews, the actual queries you write on the job may differ based on the specific role and requirements. Hope this helps!
@ajaycb590
@ajaycb590 4 ай бұрын
The queries for sure have a lot of errors. Cant group by in rank
@MrTeslaX
@MrTeslaX Ай бұрын
I feel like interviewer's focus on the parts that aren't really important i.e 18:20. Focus should be on testing the logic and the ability to get to the solution.
@shubhamdabhade3004
@shubhamdabhade3004 Жыл бұрын
👍
@Clazer07
@Clazer07 7 ай бұрын
for the last question...
@Clazer07
@Clazer07 7 ай бұрын
With nov_dec_sum as ( Select department_name, sum(case when year(order_date) = 2022 and month(order_date) = 11 then order_amount else 0 end as nov_sum, sum(case when year(order_date) = 2022 and month(order_date) = 12 then order_amount else 0 end as dec_sum From orders o join department d on o.orders_id = d.orders_id Group by department ) Select department_name, From nov_dec_sum Order by nov_sum - dec_sum desc Limit 1
@suchitkakirde1733
@suchitkakirde1733 3 ай бұрын
SELECT customer_id, COUNT(order_id) AS total_orders FROM orders WHERE order_date >= CURRENT_DATE - INTERVAL '5' YEAR GROUP BY customer_id ORDER BY total_orders DESC LIMIT 1;
Eccentric clown jack #short #angel #clown
00:33
Super Beauty team
Рет қаралды 28 МЛН
когда достали одноклассники!
00:49
БРУНО
Рет қаралды 3,9 МЛН
КАРМАНЧИК 2 СЕЗОН 6 СЕРИЯ
21:57
Inter Production
Рет қаралды 488 М.
Data Science SQL Mock Interview - Analyze Marketing Channels
23:23
Learn SQL Basics in Just 15 Minutes!
16:57
Kenji Explains
Рет қаралды 103 М.
Real SQL Interview questions for Data Analysts
12:31
Jay Feng
Рет қаралды 4,7 М.
SQL | INTERVIEW QUESTIONS | Amazon Business Analyst | Uber Business Analyst | 2022
1:43
Priyanka’s daily diaries
Рет қаралды 22 М.
Data Analyst Mock Interview
17:45
Avery Smith - Data Career Jumpstart
Рет қаралды 904
Three Tricky Analytics Interview Questions with Andrew
25:03
Jay Feng
Рет қаралды 78 М.
Eccentric clown jack #short #angel #clown
00:33
Super Beauty team
Рет қаралды 28 МЛН