LeetCode Medium 1193 Interview SQL Question with Detailed Explanation

  Рет қаралды 4,182

Everyday Data Science

Everyday Data Science

2 жыл бұрын

Question: leetcode.com/p...
In this video I solve and explain a medium difficulty leetcode SQL question using MySQL query. This question has been asked in Apple, Facebook, Amazon, Google, Adobe, Microsoft, Adobe interviews or what we popularly call FAANG interviews.
I explain the related concept as well. This question includes points to keep in mind to develop SQL queries.
LeetCode is the best platform to help you enhance your skills, expand your knowledge and prepare for technical interviews.
If you found this helpful, Like and Subscribe to the channel for more content.
#LeetCodeSQL #FAANG #SQLinterviewQuestions

Пікірлер: 14
@gajendragada_dynamites
@gajendragada_dynamites Жыл бұрын
This is the most underrated channel of you tube in linkedin also everyone is busy in praising Sumit mittal sir only ,i will proudly say i have learnt SQL from this channel
@EverydayDataScience
@EverydayDataScience Жыл бұрын
Thanks for such kind words 😊 Glad that this channel has been helpful for you.
@rohitbatra8396
@rohitbatra8396 Жыл бұрын
This is really underrated channel, I wish you get huge amount of subscribers in coming days. I am solving a lot of SQL questions now days and If I get stuck somewhere I type that leetcode number and in that search list I always choose your video to watch. Hats off :)
@tejaswaniguttula5961
@tejaswaniguttula5961 2 ай бұрын
Thanks a lot sir. When i solved it by myself. I failed in test case bur with your explanation it was done ✅ sir. Thank you so much sir
@EverydayDataScience
@EverydayDataScience 2 ай бұрын
Glad that you found the video useful 😊
@alfabinomial6183
@alfabinomial6183 Жыл бұрын
in your video u have taught us how to think and how to solve the problem !! best tutorial ever on Database management system !
@saisushanthdurvasulabitsian
@saisushanthdurvasulabitsian 2 жыл бұрын
thank you @Everyday Data Science for the video , very useful, one small change we could do to make it compact is that we could use the month alias in the group by clause instead of repeating the year month extraction logic as follows: select DATE_FORMAT(trans_date,'%Y-%m') as month , country , count(id) as trans_count , sum(case when state = "approved" then 1 else 0 end) as approved_count , sum(amount) as trans_total_amount , sum(case when state = "approved" then amount else 0 end) as approved_total_amount from Transactions group by month,country please review and let me know your thoughts , thanks
@ekosetiawan_indo
@ekosetiawan_indo 2 жыл бұрын
hmm, what if there is data from different year but same month, will this query working?
@saisushanthdurvasulabitsian
@saisushanthdurvasulabitsian 2 жыл бұрын
@@ekosetiawan_indo thanks for the question , yes we are asked to group by year_month in the question which is unique for a given month and year and we are extracting that part here and the query works! pls let me know if it dint work for you or any issue you faced , thanks
@rishikaverma9846
@rishikaverma9846 7 ай бұрын
why does my code show this error? You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') as approved_total_amount from Transactions group by date_format(trans_date, '' at line 2 select date_format(trans_date, '%Y-%m') as month, country,count(id) as trans_count, sum (case when state='approved' then 1 else 0 end) as approved_count, sum(amount) as trans_total_amount, sum(case when state='approved' then anount else 0) as approved_total_amount from Transactions group by date_format(trans_date, '%Y-%m'), country
@EverydayDataScience
@EverydayDataScience 7 ай бұрын
I guess this is because you haven’t ended the case when statement. It should be: …, sum(case when state=‘approved’ then amount else 0 END) as approved_total_amount….. Try it and let me know if this works 😊
@manojyadav6967
@manojyadav6967 Жыл бұрын
count() only count the non-null values only.just for info
@EverydayDataScience
@EverydayDataScience Жыл бұрын
Agreed. Thanks for sharing that, Manoj 😊
@sumans6033
@sumans6033 3 ай бұрын
Year is not getting
LeetCode Medium 1158 Interview SQL Question with Detailed Explanation
9:08
Everyday Data Science
Рет қаралды 2,8 М.
LeetCode Medium 1174 Interview SQL Question with Detailed Explanation
10:51
Everyday Data Science
Рет қаралды 5 М.
Challenge matching picture with Alfredo Larin family! 😁
00:21
BigSchool
Рет қаралды 30 МЛН
Пройди игру и получи 5 чупа-чупсов (2024)
00:49
Екатерина Ковалева
Рет қаралды 1,7 МЛН
Вы чего бл….🤣🤣🙏🏽🙏🏽🙏🏽
00:18
CHOCKY MILK.. 🤣 #shorts
00:20
Savage Vlogs
Рет қаралды 28 МЛН
What is ETL | What is Data Warehouse | OLTP vs OLAP
8:07
codebasics
Рет қаралды 412 М.
LeetCode 1667 Interview SQL Question with Detailed Explanation | Practice SQL
6:28
LeetCode Medium 1164 Amazon Interview SQL Question with Detailed Explanation
9:50
Introduction to NoSQL databases
26:18
Gaurav Sen
Рет қаралды 773 М.
LeetCode Medium 626 Amazon Interview SQL Question with Detailed Explanation
8:38
Is Data Science Dying in 2024? || AI and Automation
11:44
Jacob Maz
Рет қаралды 10 М.
Challenge matching picture with Alfredo Larin family! 😁
00:21
BigSchool
Рет қаралды 30 МЛН