3 SQL Queries Asked in Interview for Business Analyst - Solved

  Рет қаралды 53,765

techTFQ

techTFQ

Күн бұрын

In this video, we shall solve 3 Intermediate level SQL Queries that were asked during an interview for the role of Business Analyst.
We shall first understand the problem statement and then solve it one by one.
You can download the dataset and SQL queries from my blog below:
techtfq.com/blog/solving-sql-...
Timestamp:
00:00 Intro
00:17 First SQL Query
09:48 Second SQL Query
23:33 Third SQL Query
Join my live Python Bootcamp:
techtfq.graphy.com/courses/Py...
Join my SQL Bootcamp:
techtfq.graphy.com/courses/Re...
Thanks for watching!
Thoufiq (techTFQ)

Пікірлер: 104
@rishabh_fitness3273
@rishabh_fitness3273 9 ай бұрын
hands down!! what a genius you are ! specially the third problem and the explaination just wow,,, taufiq sir because of you , i have cleared many concepts of sql...may god bless you taufiq
@sidheshbhambid4023
@sidheshbhambid4023 9 ай бұрын
No one can make SQL look so easy! Totally worth learning SQL from your recent boot camp cohort 2. The way you approach and solve complex queries by breaking them down into smaller parts was the most important thing I learned from you! ♥ Keep bringing such content, this is what raises my confidence even more in SQL!! 😅🙌
@sakshipandey5137
@sakshipandey5137 5 ай бұрын
Excellent explanation!!💯 Thankyou for making our life easy. God bless you!
@user-kp6ev3ls5c
@user-kp6ev3ls5c 9 ай бұрын
The way of approach is easy to understand and follow , Thank you so much.
@ceejayachky6279
@ceejayachky6279 9 ай бұрын
You are an excellent teacher.
@yi-lehung6311
@yi-lehung6311 9 ай бұрын
Such great SQL content videos! I can always learn things from your videos. Shoutout to techTFQ!
@techTFQ
@techTFQ 9 ай бұрын
Happy to hear that! Thank you so much
@mounikathouda
@mounikathouda Ай бұрын
Explaining step by step clearly. Good Video 😊
@dingaroo2003
@dingaroo2003 4 ай бұрын
Greetings brother, from Singapore. As a working adult who is doing self-study, such exercises with step-by-step solutions are extremely priceless! Thank you Taufiq.
@vasimahamadshaikh3730
@vasimahamadshaikh3730 9 ай бұрын
Toufiq bhai what explains yaar . Everyone should understand what you want to give us from this video.great Bhai
@techTFQ
@techTFQ 9 ай бұрын
Thank you so much bro 😀
@sravikav1018
@sravikav1018 3 ай бұрын
It's really awesome explanation and this is the best SQL channel i have ever got,thanks a lot for sharing the knowledge. Looking forward for the more videos with SQL examples.
@ST-actual
@ST-actual 8 ай бұрын
Super useful. I’m relating everything I learn about SQL to New Relic which is what my company uses for observability.
@techTFQ
@techTFQ 6 ай бұрын
Thank you very much 😊
@vigneshwarannallasamy
@vigneshwarannallasamy 8 ай бұрын
Hi Thoufiq, really loved your videos and learned a lot from you. It will be beneficial if you can share the Cheat Sheet of SQL syntaxes.
@user-ks5nx9jk6u
@user-ks5nx9jk6u 4 ай бұрын
Thank you Toufiq bhai, the way that you explained queries is so good and i hope who don't have any knowledge on sql they will easily to understand
@mkarvj
@mkarvj 8 ай бұрын
You are absolutely amazing sir!!!!
@DHA508
@DHA508 9 ай бұрын
Thanks for awesome session.
@fenix6627
@fenix6627 8 ай бұрын
After a week of watching your lessons, I was able to solve these queries for myself, thanks a lot.
@techTFQ
@techTFQ 6 ай бұрын
Great 👍
@F_A_R_man
@F_A_R_man 5 ай бұрын
Thanks for efforts. Your content is very useful 🥰
@BharathKumar-id8wk
@BharathKumar-id8wk 9 ай бұрын
❤good one
@krishnakantsharma8021
@krishnakantsharma8021 4 ай бұрын
Wow, you are the best🎉
@riasingh11
@riasingh11 26 күн бұрын
You are the best tech teacher
@saiswaroop3570
@saiswaroop3570 8 ай бұрын
Hi, toufiq your videos on SQL are very good and your explanation is very detailed. It would be helpful if you post more content on SQL like this and share some roadmaps how we can grow with SQL as primary skill. Please suggest some good certification courses for SQL that are available online
@nikhilreddy4582
@nikhilreddy4582 9 ай бұрын
Bro u r a gem... Keep doing many more contents. This help me understand to solve the queries in a more better way. As I have also attempted these queries but failed to solve it. These are from hacker rank got it in a meesho 1st round. These video help me understand much better. Thanks a lot broo...
@brunomiguel3533
@brunomiguel3533 7 ай бұрын
Amazing stuff. Really enjoyed it and learned a lot. 5 stars!
@techTFQ
@techTFQ 6 ай бұрын
Thank you
@maghy_kethychannel
@maghy_kethychannel 9 ай бұрын
Hi toufiq really hats off to your afforts and explanation.plz start an exclusive course on data analytics.
@techTFQ
@techTFQ 9 ай бұрын
Thank you bro, I will try my best
@dkaustubh
@dkaustubh 9 ай бұрын
Great video ❤ Thanks !
@techTFQ
@techTFQ 9 ай бұрын
Glad you liked it!
@saswatkumar2517
@saswatkumar2517 3 ай бұрын
brilliant explanation
@achunaryan3418
@achunaryan3418 9 ай бұрын
Excellento.
@ganeshvbidve
@ganeshvbidve 9 ай бұрын
Oh great video and insightful Upload more video about stored procedure and udf functions with exception handling
@techTFQ
@techTFQ 9 ай бұрын
Thank you and noted bro
@fathimafarahna2633
@fathimafarahna2633 9 ай бұрын
You are as always best 💯 God bless
@techTFQ
@techTFQ 9 ай бұрын
Thank you so much 😀
@RoopmathiGunnaubcmba
@RoopmathiGunnaubcmba 9 ай бұрын
The third one was the most challenging for me to get my head around.
@RajeshwarUma
@RajeshwarUma 9 ай бұрын
Thank you so much
@m.kirubakaran6564
@m.kirubakaran6564 9 ай бұрын
Thanks Man.. very very useful.. very easy to understand Big Thx......
@dikshapatiyal5986
@dikshapatiyal5986 Ай бұрын
You are Amazing
@sivagowthu859
@sivagowthu859 9 ай бұрын
1st question my way of approach with cte as( select * from candidate c inner join results r on c.id=r.candidate_id) select party,count(*) as no_of_seats from( select *,dense_rank()over (partition by constituency_id order by votes desc) as rn from cte ) dt where rn=1 group by party
@kamalikamukherji6482
@kamalikamukherji6482 9 ай бұрын
Ur the best❤
@ambeshpandey8937
@ambeshpandey8937 19 сағат бұрын
First one my approach with cte as(select *, min(votes) over (partition by constituency_id) as lowest_vote from result), cte2 as( select *, (votes-lowest_vote)as vote_diff from cte), cte3 as ( select *, row_number() over (partition by constituency_id order by vote_diff desc) as rnk from cte2) select concat(c.party,' ',count(*)) as party_seats from cte3 join candidate c on cte3.candidate_id=c.d where rnk=1 group by c.party
@varunl6948
@varunl6948 7 ай бұрын
Thanks for this!
@techTFQ
@techTFQ 6 ай бұрын
You're welcome
@kunalkumar-hl6gv
@kunalkumar-hl6gv 9 ай бұрын
this is not intermediate level but yet it is very useful there are so many things to get from this video
@techTFQ
@techTFQ 9 ай бұрын
good to know
@vishalgoswami7512
@vishalgoswami7512 9 ай бұрын
what level is this then?
@rohankhubchandani3694
@rohankhubchandani3694 9 ай бұрын
@@vishalgoswami7512i would say it’s advanced
@houcineb4139
@houcineb4139 9 ай бұрын
thank you
@TheDocValerian
@TheDocValerian 7 ай бұрын
This is a great video. I can only imagine how it is to solve if you had to wtite this on a simple paper as a candidate
@techTFQ
@techTFQ 6 ай бұрын
Thanks:)
@deepaknayak1195
@deepaknayak1195 9 ай бұрын
Thanks ❤
@techTFQ
@techTFQ 9 ай бұрын
You're welcome 😊
@dravidbalaji1373
@dravidbalaji1373 4 ай бұрын
Super bro
@jakusam4564
@jakusam4564 9 ай бұрын
Dear sir ,when your next SQL live bootcamp start?eagerly waiting for this
@newenglandnomad9405
@newenglandnomad9405 9 ай бұрын
I understand the interview questions. What I don't understand is how that political query would apply to the job. I have a friend that works in Soccer, and he's asked to query seat sales by seat type or unsold or whatever, and sends a spreadsheet with the answer. Are these interview questions like just practice sandbox type queries? Thanks for educating us.
@LokeshKumar-ii1or
@LokeshKumar-ii1or 8 ай бұрын
Hi Sir Please do one video for how to retrieve specific data from XML column in Oracle SQL
@Al-Ahdal
@Al-Ahdal 9 ай бұрын
Hi I am a professional accountant, and do loads of business analysis, reporting etc in Excel. I would like to learn Business SQL for Data Analytics, kindly share the road map and learning source. Thanks
@ManpreetSingh-tv3rw
@ManpreetSingh-tv3rw 9 ай бұрын
Query 3 ,MSSQL with echo as (select state,candidate_id,count(candidate_id) as seatcount_byid from results_tab group by state,candidate_id), rt as ( select *,dense_rank() over (partition by candidate_id order by seatcount_byid desc) as position from echo), final1 as (select * from rt where position
@razikamuthu3795
@razikamuthu3795 9 ай бұрын
Can you please share next boot camp slots for SQL
@avinashpratapsingh3875
@avinashpratapsingh3875 7 ай бұрын
Hi @techTFQ in the second query you have use group by clause on alias customer and status, but as per execution order group by is executed before select, so when I tried running query you explained it throws me error invalid identifier, Cn you please let me know what to do. I am using Oracle SQL Developer
@user-pz8vn8ht9u
@user-pz8vn8ht9u 9 ай бұрын
Do you have any idea of starting PlSql bootcamp?
@lalitak9404
@lalitak9404 9 ай бұрын
Here is the query with out window function : Select concat(party,' ',count(*)) from (select constituency_id,max(votes)as votes from candidates c inner join results r on c.id=r.candidate_id group by constituency_id)as temp inner join results r on temp.constituency_id=r.constituency_id and temp.votes=r.votes inner join candidates c on r.candidate_id=c.id group by party;
@vermaji5220
@vermaji5220 5 ай бұрын
with cte as (select c.id, c.party,r.constituency_id,r.votes from candidates as c inner join results as r on r.c_id=c.id), cte1 as( select * , rank() over (partition by constituency_id order by constituency_id, votes desc) as rn from cte) select party, count(1) as won_seat from cte1 where rn=1 group by party
@RoopmathiGunnaubcmba
@RoopmathiGunnaubcmba 9 ай бұрын
@TechTFQ: This question is for which company? In India or North America?
@mohanmuppidi6846
@mohanmuppidi6846 7 ай бұрын
S man.. It is good
@techTFQ
@techTFQ 6 ай бұрын
Thank you
@gayatribhuyan1600
@gayatribhuyan1600 9 ай бұрын
Hi,Can you make some sql interview questions for data engineers.
@techTFQ
@techTFQ 9 ай бұрын
let me see if I can find any
@rimaranimeher9644
@rimaranimeher9644 7 ай бұрын
Please do more interview questions on mysql
@techTFQ
@techTFQ 6 ай бұрын
Noted
@ramshabdaramnaresh9438
@ramshabdaramnaresh9438 9 ай бұрын
In SQL Server string_agg not supporting distinct then how to solve 2nd one
@jayantachakraborty4915
@jayantachakraborty4915 9 ай бұрын
08:48 I did not understand why we used count(1). Could you help me understand?
@anudeepreddy5559
@anudeepreddy5559 9 ай бұрын
Plsql bootcamp please
@murchhanabanerjee862
@murchhanabanerjee862 4 ай бұрын
Hi Taufiq, I am your fan ! You have become the ultimate destination to clear doubts & concept. I want to share 2 sql problems which I couldn't solve in interview. How should I share ? Can't find your email in this chat .
@techTFQ
@techTFQ 4 ай бұрын
Thank you 🙏 Glad to hear that .. my email techtfq@gmail.com
@b_rizzle4808
@b_rizzle4808 9 ай бұрын
will using an order by in a cte slow down query performance? or will it just be ignored
@techTFQ
@techTFQ 9 ай бұрын
order by is unnecessary inside a cte because the purpose of cte is to return a resultset, how the resultset is ordered is not necessary. And yes order by will consume some resources so better to avoid it when its not required
@Kondaranjith3
@Kondaranjith3 9 ай бұрын
Hi sir string_agg function in postgress but i am using mssql server i could not find the aternative function for it
@shivambansal3560
@shivambansal3560 9 ай бұрын
try going with group_concat()
@favoura5555
@favoura5555 5 ай бұрын
Why did we join when we already used cte?
@promitdutta3029
@promitdutta3029 8 ай бұрын
how to do string_agg fcn in mysql ?
@jetsfromnewjersey1377
@jetsfromnewjersey1377 9 ай бұрын
Hi taufiq i want to buy sql course but payment portal is not able to accept my card itrat ali from NJ USA
@rickymahakul3871
@rickymahakul3871 9 ай бұрын
My age is 32 can I enter into data analyst job if I acquire skills required for this job role
@RyanLoh
@RyanLoh 8 ай бұрын
Hi which software are you using to write this SQL code?
@techTFQ
@techTFQ 6 ай бұрын
PostgreSQL DB, PG Admin tool
@nivisworld1513
@nivisworld1513 9 ай бұрын
Hai....sir.... please write the querys 1) how to find highest salary of the employee? 2) query to find 2nd ,3rd,4th ....higest salaries? And query to find nth highest salary?
@vishalgoswami7512
@vishalgoswami7512 9 ай бұрын
use rank over order by salary
@nivisworld1513
@nivisworld1513 9 ай бұрын
@@vishalgoswami7512 if u don't mind....can you write?
@user-bg1bn7np4u
@user-bg1bn7np4u 9 ай бұрын
Can we use count(*) instead of count(1) in my sql?
@jayantachakraborty4915
@jayantachakraborty4915 9 ай бұрын
Same question. Did you find any solution?
@rushikeshjoshi9506
@rushikeshjoshi9506 9 ай бұрын
I know this is from hacrkrank interview questions for ETL Testing I faces this all 3
@techTFQ
@techTFQ 9 ай бұрын
nice, good to know
@sarvesht7299
@sarvesht7299 9 ай бұрын
Which company bro ?
@pratheeshsailor5193
@pratheeshsailor5193 9 ай бұрын
​@@sarvesht7299meesho
@devarapallivamsi7064
@devarapallivamsi7064 Ай бұрын
I am seriously gonna laugh at people if they opt for any paid course of SQL even after coming across your channel. Hands down I would choose you over anyone to learn SQL from.
@nivisworld1513
@nivisworld1513 9 ай бұрын
I know these are the basic qns but i need proper queries plz ...( if anybody see my mes... u can also rply )
@Fitness_Gallery
@Fitness_Gallery 9 ай бұрын
Sir please make the video in Hindi because Hindi is familiar for us
@rohit_vora
@rohit_vora Ай бұрын
with cte as (select row_number() over(partition by party ) rn, c.id, party, constituency_id, votes from candidates c join results r on r.candidate_id = c.id), cte2 as (select c1.id, c2.id, c1.party, c1.constituency_id,c2.constituency_id, c1.votes dvot, c2.votes rvot from cte c1 join cte c2 on c1.constituency_id = c2.constituency_id and c1.rn = c2.rn and c1.party c2.party), cte3 as (select *, case when dvot > rvot then 1 else 0 end flag from cte2) select concat(party, ' ', total) wons from (select party, sum(flag) total from cte3 group by 1)
@MJTECH4U
@MJTECH4U 9 ай бұрын
Appreciate it. @techTFQ
Crack the Top 25 SQL Interview Questions - KSR Data Vizon
32:47
KSR Datavizon
Рет қаралды 191 М.
Каха ограбил банк
01:00
К-Media
Рет қаралды 9 МЛН
Just try to use a cool gadget 😍
00:33
123 GO! SHORTS
Рет қаралды 84 МЛН
Wait for the last one! 👀
00:28
Josh Horton
Рет қаралды 48 МЛН
Solving SQL Interview Queries | Tricky SQL Interview Queries
37:22
Swiggy Data Analyst SQL Interview Question and Answer
17:05
Ankit Bansal
Рет қаралды 11 М.
Каха ограбил банк
01:00
К-Media
Рет қаралды 9 МЛН