Learn how to write SQL Queries(Practice Complex SQL Queries)

  Рет қаралды 1,538,385

techTFQ

techTFQ

Күн бұрын

Learn how to write SQL Queries(Practice Complex SQL Queries)
In this video, I will explain the thinking behind writing an SQL query. We shall go through five different complex SQL queries and try to solve it. The intention is to practice complex SQL queries. The idea is to not just write SQL Queries but also to explain you the thinking behind how to choose a particular approach to solve a SQL query and how to choose different SQL functions or concepts to solve a problem.
Link to my blog where I have posted all of these SQL Queries:
techtfq.com/blog/learn-how-to...
In this blog, you will find 9 SQL queries along with all the scripts to create the table, load data into these tables and also the solved SQL Queries. Out of these 9 SQL Queries, In this video, I have only solved 5 of them in order to reduce the video length.
Timeline:
00:00 Intro
01:36 Intro about the blog
03:25 SQL Query to fetch duplicate records from a table using window function
09:27 SQL Query to fetch doctors working in same hospital using self join
15:55 SQL Query to fetch users who logged in consecutively 3 or more times
25:10 SQL Query to fetch days when the temperature was very cold for consecutively 3 or more days
36:13 SQL Query to fetch top 2 accounts with maximum patients per month
Learning SQL Concepts and practically writing SQL queries are two different things. You may be familiar with the concept such as window function but until and unless you apply these concepts to write SQL queries, you will never truly understand SQL.
May of the queries I am going to solve in this video, I will be using window function such as LEAD, LAG, RANK, ROW_NUMBER etc. However, some of the queries are solved using self join, sub queries or inner joins.
The idea behind making this video, is to explain the thinking behind solving an SQL question. How to read the question and understand the problem statement and then analyze the existing data so that we can come up with an approach to write a query which can return the required result. These steps are very important in order for us to determine the different SQL concepts or functions to be used to solve the problem.
Please comment below your feedback if you liked this kind of video or if you have any doubts on any other queries mentioned in the blog.
🔴 WATCH MORE VIDEOS HERE 👇
✅ SQL Tutorial - Basic concepts:
• SQL Tutorial - Basic c...
✅ SQL Tutorial - Intermediate concepts:
• SQL Tutorial - Interme...
✅ SQL Tutorial - Advance concepts:
• SQL Tutorial - Advance...
✅ Practice Solving Basic SQL Queries:
• Practice Solving BASIC...
✅ Practice Solving Intermediate SQL Queries:
• Practice Solving INTER...
✅ Practice Solving Complex SQL Queries:
• Practice Solving COMPL...
✅ Data Analytics Career guidance:
• Data Analytics career ...
✅ SQL Course, SQL Training Platform Recommendations:
• SQL Course / Training
✅ Python Tutorial:
• Python Tutorial
✅ Git and GitHub Tutorial:
• Git and GitHub
✅ Data Analytics Projects:
• Data Analytics Projects
THANK YOU,
Thoufiq

Пікірлер: 1 100
@magicmedia7950
@magicmedia7950 24 күн бұрын
Who else thought that they knew SQL until they came across this and then realized that they have a long way to go?😅
@presidentbrown
@presidentbrown 2 жыл бұрын
After going through this I realised how much we can do with SQL. I thought I knew SQL but now I know there's a lot to learn.
@_RahulDewangan
@_RahulDewangan Ай бұрын
Exactly my thoughts.....but i have my interviews soon 😭😭
@swatisingh-vs1bx
@swatisingh-vs1bx 2 жыл бұрын
This is by far the best video for understanding SQL queries, the way you have explained by running small parts first and than solving to get the end output and also the pace was very much decent. Thanks man ! and please continue to make more of such videos :)
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Swati 🙏🏼 Truly appreciate such detailed feedback 🙂 So glad this helped you.
@yaroslavpanych2067
@yaroslavpanych2067 2 жыл бұрын
It is not. It is really not!
@amsalespush
@amsalespush 2 жыл бұрын
So far, the best video I have found on complex SQL. Great examples of practical value, very well explained. Thanks a lot.
@sreerams2677
@sreerams2677 2 жыл бұрын
Hi, Thank you for your time and effort. Please continue these complex queries as a series. Thank you once again, i am getting a hold on sql after watching your videos especially on CTE's and sub queries which plays a major role in getting required outcome.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Sreeram 🙏🏼 I am so happy to know you have benefited from my video’s .. Yeah will continue making more such videos. Tomorrow will be posting a video about a particular complex Sql query so hopefully you will like that one too..
@MariadelCarmen-gj8ul
@MariadelCarmen-gj8ul Жыл бұрын
@@techTFQ quick question, does "select d1.* from doctors d1 JOIN doctors d2 ..." works exactly than "select d1.* from doctors d1 INNER JOIN doctors d2..."? Thank you in advance
@danielessiet4063
@danielessiet4063 Жыл бұрын
I have sent you a request on LinkedIn.
@Devasinger-0070
@Devasinger-0070 9 ай бұрын
​@@MariadelCarmen-gj8ulyes
@MariadelCarmen-gj8ul
@MariadelCarmen-gj8ul 9 ай бұрын
@@Devasinger-0070thank you so much!
@mohammedidris2840
@mohammedidris2840 Жыл бұрын
Its not at all a tutorial video its a master or an expert explaining. You dont explain the approach or idea you just make everything clear in all the concepts you explain. Awesome
@mathieudager4234
@mathieudager4234 2 жыл бұрын
TechTFQ: super great job. This is high quality knowledge sharing. Like you said knowing the different clauses and expressions doesn’t mean being able to apply them to concrete queries. Keep these great tutorials coming please. If you could increase the degree of complexity with aggregate functions that’d be super appreciated. Can’t wait to watch your next vids. Got yourself a new subscriber. Thanks a lot.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Mathieu 🙏🏼 So glad to read this comment.. will consider your suggestion to include more complexity in the future.. glad you are subscribed ☺️
@fathimafarahna2633
@fathimafarahna2633 2 жыл бұрын
Nothing like your contents on this whole KZfaq. Genuinely appreciate your efforts in churning out such beneficial n functional contents🙏Also, the blog is just amazing. Clean, clear, authentic. Kudos to your efforts n intention👏🙌
@techTFQ
@techTFQ 2 жыл бұрын
Thank you very much ❤️ And there is nothing like your support 😍🙏🏼
@abdullahmusheer4238
@abdullahmusheer4238 2 жыл бұрын
Every other SQL tutorial youtuber just shares the basics which is good , but going through these examples and approach is really well thought of.. Appreciate the work! Thank you
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Musheer 🙏🏼 Glad you liked my work
@pranabthakuria1897
@pranabthakuria1897 2 жыл бұрын
Loved your step-by-step approach towards solving complex SQL queries. Hope to see more similar videos in the coming days and really appreciate your hard work in making such a helpful content.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Pranab for your kind words.. Glad the video helped ☺️
@maniguvvala3853
@maniguvvala3853 2 жыл бұрын
Cf
@siskaagustiningsih4501
@siskaagustiningsih4501 2 жыл бұрын
Īi
@siskaagustiningsih4501
@siskaagustiningsih4501 2 жыл бұрын
@@techTFQ III III i
@siskaagustiningsih4501
@siskaagustiningsih4501 2 жыл бұрын
Īi in i
@mounikakondrapu7660
@mounikakondrapu7660 2 жыл бұрын
I have cleared one of my interviews with top MNC company because of this training video. Thank you so much.
@techTFQ
@techTFQ 2 жыл бұрын
Amazing … congratulations Mounika 💐 I am so glad to read this comment ☺️🙏🏼
@chusman4743
@chusman4743 10 күн бұрын
Congratulations monika on clearing your interview! 🎉 I'm currently preparing for a similar interview for an SQL Server position and was wondering if you could share any tips or a list of the questions you were asked? Your insight would be incredibly helpful. Thank you so much in advance!
@yrrep27
@yrrep27 Жыл бұрын
Just want to say first, this channel is invaluable. Thought I'd offer up a solution for problem 7 that's a little more concise. This assumes that as in the example data, consecutive increasing id numbers correspond to consecutive increasing dates, with each id number corresponding to a unique day. The approach is: 1. Remove records with temperatures above 0 using a WHERE statement. 2. Of the remaining rows check each one to see if it is part of a consecutive triplet-- we could use the date column for this with a specialized date function, but it's easier to use the id column, if the assumption stated above is true 3. A row in a consecutive triplet will meet one of three criteria: Either A-- the two leading rows have consecutive id numbers, B. The lagging row and the leading row both have a consecutive id, or C. The two lagging rows have consecutive ids. 4. The CASE statement checking for these criteria are then packaged in a subquery returning just the id of qualifying rows. 5. The main query uses IN to return only rows having the ids returned by the subquery. SELECT * FROM weather WHERE id IN (SELECT CASE WHEN id + 1 = (LEAD(id) OVER ()) AND id + 2 = (LEAD(id, 2) OVER ()) OR id - 1 = (LAG(id) OVER ()) AND id + 1 = (LEAD(id) OVER ()) OR id - 1 = (LAG(id) OVER ()) AND id - 2 = (LAG(id, 2) OVER ()) THEN id END as check FROM weather WHERE temperature < 0)
@mdsaidulislamsayed6063
@mdsaidulislamsayed6063 2 жыл бұрын
you are so well spoken! no unnecessary talk, straight to the point, in depth explanation!
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Saidul. glad you liked it :)
@dhruvmadaan3276
@dhruvmadaan3276 2 жыл бұрын
I subscribed to your channel while you were still explaining query #2 Your speed and way of explaining as well as the examples you picked are SPOT ON ! WE NEED MORE VIDEOS, QUERIES and EXAMPLES FROM YOU !! PLEASE POST MORE VIDEOS... THANK YOU !!
@techTFQ
@techTFQ 2 жыл бұрын
Thank you so much bro.. I am glad you liked the content. Sure will post more such videos
@rodneyoganga6693
@rodneyoganga6693 2 жыл бұрын
I wish i could be as good as you at SQL, am struggling, God help me, thank you for such a well explained tutorial with amazing dedicastion.
@techTFQ
@techTFQ 2 жыл бұрын
Hi Rodney, Thank you for such kind feedback 🙏🏼 Am so glad this could help you .. I feel if you keep spending time to learn Sql every day for 1-2hrs, I am sure within a month you would be very comfortable and you should be able to solve most Sql queries .. Just needs time, patience and belief that you can do it .. keep the faith and I am sure you will master SQL soon..
@user-jl5zo2tl8s
@user-jl5zo2tl8s 6 ай бұрын
How are you doing at SQL now???
@kartikeytyagi9119
@kartikeytyagi9119 5 ай бұрын
How your sql now?
@ProfitableStockTrader
@ProfitableStockTrader 3 ай бұрын
Rodney does not respond to simple queries now. He's in an advanced query mode now. Here is the query that might initiate a response from Rodney: - Hey Rodney, does your existence on the Planet Earth been achieved, now that you have questioned on a YT video and also got an interesting and encouraging reply from the YT channel admin which might have initiated you to spend more than 2 hours o a daily basis with endless belief that you can achieve the impossible and with the time and patience you had in your hands, you spent the time wisely and now have reached the Query Nirvana in any QL?
@techTFQ
@techTFQ 3 ай бұрын
Too funny man 😅 Bravo to you if you get the desired response 😬
@konstantindemchenko5496
@konstantindemchenko5496 2 жыл бұрын
15:27 the first condition d1.id d2.id is redundant since its more narrow than d1.speciality d2.speciality
@lokeshgunjugnur2807
@lokeshgunjugnur2807 2 жыл бұрын
Fantastic..This helps infrastructure oriented DB engineers like us to quick assist customers with query tuning or performance tasks. Thanks for making time to share this dude.
@techTFQ
@techTFQ 2 жыл бұрын
Your welcome Lokesh 🙏🏼 Glad this helped
@laurak5196
@laurak5196 2 жыл бұрын
I’ve finally watched the whole thing and this is definitely my favorite kind of your videos. I learn the most by watching you and hearing your thought process and the nice bonus is then I can go and download your script, create an identical table and then go try and do it myself. That’s where I learn the most, bc I can try my own ideas and just make little changes and see if that completely throws an error and then I try and understand why that error was thrown so I can avoid that problem in the future. Thank you again for your help and your time investment. Over 113K views on here shows I am not the only one this is helping. 🙏🏻 Many blessings to you and your family, TFQ
@techTFQ
@techTFQ 2 жыл бұрын
Thank you so very much Laura 🙏 I am really impressed by the way you are trying to use this resource to learn and practice SQL. Very happy to be contributing to your learning too.. Happy learning and wishing you all the very best :)
@laurak5196
@laurak5196 2 жыл бұрын
@@techTFQ And it’s working because I repeated the course on joins and also intermediate sql on DataCamp and after watching your videos on key topics, I was able to make significant progress. Their lectures are very short and the material was completely new to me the first time. Also I was trying to take too many classes and not allowing time to absorb the information. Watching your more detailed explanations helped me a lot and now I believe I’ll be able to solve most of the queries you’ve posted. I’ve created all of your tables in my database so that I can make sure of that. I have a deadline to meet to pivot my career and so I am a little in rush mode and I’m so glad I found your videos when I did because they are exactly what I needed to supplement those courses. Again, I realize how much time and thought went into this and as the mascot I’d like to speak for all of your viewers and offer our appreciation for all of it 🙏🏻😀
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Laura ☺️ You have the right attitude for learning SQL and I am sure you will solve every query in this blog.. All the best 👍
@laurak5196
@laurak5196 2 жыл бұрын
@@techTFQ thank you again for your encouragement and have a wonderful evening 🙏😀
@techTFQ
@techTFQ 2 жыл бұрын
You too Laura ☺️
@mrmuranga
@mrmuranga Ай бұрын
Anyone starting out or wishing to improve there SQL , this is definitely for us. Great job👏👏👏
@pedramhaqiqi7030
@pedramhaqiqi7030 2 жыл бұрын
Great video, for #4. Since the same doctor will not have different specialist, we can just compare hospital names and specialist and it will make sure we do not have the same doctor being compared with him/her self.
@vijaypalmanit
@vijaypalmanit 2 жыл бұрын
superb, had been looking for someone for very long who teaches complex queries in simplest manner, finally search ends here.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Vijay 🙏🏼 Glad You liked my videos ☺️
@SagarKumar-db2xy
@SagarKumar-db2xy 2 жыл бұрын
Watched tons of SQL contents, this is by far best and quality content. Keep adding more. Please also share the SQL for entry level data analyst
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Sagar 🙏🏼 Glad you liked it.. Sure SQL for data analysis, let me plan something
@zion96776
@zion96776 2 жыл бұрын
@@techTFQ do you have course on it ?
@techTFQ
@techTFQ 2 жыл бұрын
Hi Carlos, do not have any course as of now . May be will plan to create one in future..
@NitinKumar-vw9gb
@NitinKumar-vw9gb 5 ай бұрын
Thank you so much sir ,I watched your video and able to solve multiple query in interview,now I'm selected 😊 as software developer trainee
@krishpoptani7862
@krishpoptani7862 7 күн бұрын
Absolutely stunning and insightful video, I come here every 15 days to revise my SQL concepts.
@sivakarthikayanb8214
@sivakarthikayanb8214 2 жыл бұрын
Man, this tutorial is really awesome!!! Thank you so much for your detailed explanation. It will be very great if you post more videos on solving complex queries!!!
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Siva 🙏🏼 Glad you liked it .. yes will be making more videos on solving sql queries
@BrotoBhattacharjee
@BrotoBhattacharjee 2 жыл бұрын
This is an awesome tutorial video. It touches upon exactly the pain points and explains the concept in a great detail.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Broto 🙏🏼 Glad you found this helpful ☺️
@muskanchaudhary5265
@muskanchaudhary5265 2 жыл бұрын
you literally make the best videos!! please keep making more with more queries and performance tuning tricks and interview focused complex queries. Thank you so much for your amazing content!
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Muskan 🙏🏼 So happy to read this feedback ☺️ And yes I will make more query videos
@aravind7627
@aravind7627 3 ай бұрын
After going through multiple videos. finally landed in the best channel. I am able to follow you effortlessly for more hours. Thank you so much.
@fathimafarahna2633
@fathimafarahna2633 Жыл бұрын
1M views… Masha Allaah… You deserve much more.. Keep growing n benefiting 👍👍👍
@michaelbarry1437
@michaelbarry1437 2 жыл бұрын
Thank you!!! I discovered Process Query Language (PQL) that uses Lead & Lag times (different structure) and the concepts really help with understanding.
@techTFQ
@techTFQ 2 жыл бұрын
Your welcome Barry🙏🏼 Glad this helped ..
@voodoochili12
@voodoochili12 2 жыл бұрын
Awesome video. I would love to see you tackle the subject of Gaps and Islands. Great job and thank you!
@glorysowji9218
@glorysowji9218 2 жыл бұрын
Thank you so much for sharing such an extreme knowledge with us. Now I'm able to get some idea on the complex queries and practicsing as well. All your videos are very much helpful for me. Thanks a lot for taking so much effort and time to make these videos. Easy to understand and grasp the hidden concepts practically. Plz do share more on window functions queries used in real-time. God Bless You.👍🤝
@marciojrtorres
@marciojrtorres 2 жыл бұрын
Thank you Thoufiq, I learned a lot from the examples you've provided. Greetings from Brazil 👋
@techTFQ
@techTFQ 2 жыл бұрын
So glad to receive feedback from Brazil 😃 I am so glad you liked it Torres 🙏🏼
@abinsharaf8305
@abinsharaf8305 2 жыл бұрын
as a mac user, your videos were mashallah very helpful, especially the way you think gives a practical approach to finding solutions. As a beginner i find it very nice thanks brother and keep up good work.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Abin 🙏🏼 Glad the video helped ..
@receps.8396
@receps.8396 2 жыл бұрын
Thanks a lot man. One lesson teaches us subquery, ranking and distinct. All in one.
@anishvarghese8169
@anishvarghese8169 2 жыл бұрын
This is the only SQL related video on KZfaq I have watched throughout without clicking the skip button
@laurak5196
@laurak5196 2 жыл бұрын
TFQ, I predict greatness for your channel with content like this. Seriously, you stand apart because your explanations are so clear and you put so much time and effort forward for your videos and this shows. I think I speak for all your subscribers when I say thank you, thank you. We SO appreciate all of your hard work. 100K will be in your rear view mirror before too long, my friend. 👍🏻😊
@laurak5196
@laurak5196 2 жыл бұрын
I also want to add that I’m so happy right now because I was having troubles with a Leetcode query I was trying to solve and after your terrific explanation about self-joins, which I’d struggled a bit with in the past, I was able to go right back there and quickly solve it. I don’t know if you’re interested in teaching, but you’re a natural at it. Thank you so much! I now understand something in a few minutes that had really confused me in the past! Blessings to you and yours for a wonderful November, TFQ!
@techTFQ
@techTFQ 2 жыл бұрын
Thank you thank you Laura 🙏🏼 🙏🏼 It’s so true that each of these videos take a lot of effort to make but getting this kind of feedback makes everything worth it.. I am short of words to thank you for your support and I just wish you success in everything you do.. I am also so glad to hear that you could apply the teachings in this video to solve leetcode queries.. I feel overwhelmed by this feedback .. Thank you once again and have a great start to the month.. 🙏🏼☺️
@laurak5196
@laurak5196 2 жыл бұрын
@@techTFQ I used to have an art blog and it took quite a bit of effort, so I can only imagine the time to film, plan etc., but your explanations simplify complex operations so well that I feel your efforts are bound to bear fruit. Look how much your channel has grown already! You’re doing great, and we thank you again. 🙏🏻👍🏻
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Laura 🙏🏼☺️
@laurak5196
@laurak5196 2 жыл бұрын
@@techTFQ I’m a new subscriber and you’ve gained over 1,000 followers since I’ve joined you last week 😱 which imo is amazing, TFQ!
@ritikajaiswal3824
@ritikajaiswal3824 2 жыл бұрын
OMG, this was my reaction when you cleared my doubt on lead and lag... I don't know whether you're a good employee or not but YOU'RE AN AMAZING TEACHER. I regret not taking your intermediate live sessions. Do tell me if you're starting a next batch on intermediate queries.
@techTFQ
@techTFQ 2 жыл бұрын
I am glad this video helped Ritika .. as for next batch , have not planned it
@Aditya-um6wc
@Aditya-um6wc Жыл бұрын
@@techTFQ Hi, from where I can get files and I can use them as database? So I can perform queries
@billb6283
@billb6283 2 жыл бұрын
Was glad to see your "Download script"...at least for the 1st example also worked with SQLite. It also needed the rowid change for the SELECT. SQLite is stand alone and doesn't require a server.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Bill 🙏🏼 Glad to know you found this useful ☺️
@amyfarrahfowler7732
@amyfarrahfowler7732 2 жыл бұрын
This is by far the best tutorial for SQL-queries. You save my studies and my peace of mind
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Amy. glad you liked it :)
@sudeeppoonoth3595
@sudeeppoonoth3595 2 жыл бұрын
Totally agree with many of the viewers comments. You are the best SQL guru I have seen on KZfaq. Wish you were our teacher in college when we learned these without this much clarity.Hats off to dedication and hard work..👏👌
@techTFQ
@techTFQ 2 жыл бұрын
That’s a very kind appreciation 🙂 Thank you Sudeep 🙏🏼 Am glad I can add some value through these video’s
@sahilkadu5409
@sahilkadu5409 2 жыл бұрын
You are the greatest SQL teacher i have seen. Period
@techTFQ
@techTFQ 2 жыл бұрын
haha Thank you Sahil :)
@jawa4763
@jawa4763 2 жыл бұрын
Your explanations are kind of addictive :) Can’t stop or skip in between , The use cases are very well descriptive , Hats off to your amazing effort ! Finally managed to stop at 12:10 am Central European Time ;)
@techTFQ
@techTFQ 2 жыл бұрын
Haha thank you bro ☺️ Glad you liked it
@alex45688
@alex45688 Жыл бұрын
brother love your teaching style , you break down each and everything about the query, hats off need more such videos would be helpful for strugglers
@myindia5604
@myindia5604 2 жыл бұрын
Realy very good content delivered. I never seen anyone who explain like this. Great work. ❤️
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Hari 🙏🏼 So glad to hear such positive feedback.. glad this helped 🙂
@szebart
@szebart 2 жыл бұрын
Fantastic tutorial, very well explained step by step. All is clear to me after watching your vids. Thank you my friend!
@techTFQ
@techTFQ 2 жыл бұрын
Thank you so much bro 🙏🏼 Very glad to know you liked the content 🙂
@mayadashaat5348
@mayadashaat5348 2 жыл бұрын
ة
@LovelyJordy
@LovelyJordy Жыл бұрын
Hi there, thank you so much for sharing your knowledge. I am self learning, and your examples have helped me so much with the advanced concepts. Thank you!!!!!!
@saurabhbhapkar9437
@saurabhbhapkar9437 9 ай бұрын
@techTFQ the temperature question is crazy! Covered lead,lag so beautifully.
@narravularushitha6806
@narravularushitha6806 2 жыл бұрын
Hi TFQ, For Query 5 : From the login_details table, fetch the users who logged in consecutively 3 or more times. Instead of lead function we can use Rank as well ryt. This also gives correct output. Below is my Query and please let me know if this is the right way to use Rank function or not. select distinct user_name from (select *,rank() over(partition by user_name order by login_date ) as rnk from login_details ) where rnk >=3 ;
@LostZoro266
@LostZoro266 Жыл бұрын
it will work only for this type of data but if it was different then i don't think this will work
@dipalipatil7917
@dipalipatil7917 Жыл бұрын
no its not working
@prashantmarathe6515
@prashantmarathe6515 2 жыл бұрын
superb examples of complex query ! Appreciate yours knowledge and this contain , thank you
@techTFQ
@techTFQ 2 жыл бұрын
Your welcome Prashanth 🙏🏼 Glad you liked it …
@GazbertUK
@GazbertUK 2 жыл бұрын
FYI - I'm doing the exercises using MySQL (using POPSQL) and for query 5, using the line INSERT INTO login_details values(113, 'James', current_date+6); was giving me an error because it was trying to store 2021-11-32, so I had to change the line to INSERT INTO login_details values(113, 'James', DATE_ADD(current_date, INTERVAL 6 DAY)); Great series of vidz, I'm learning so much and my head is starting to get into the SQL groove.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Gazbert for sharing the solution. This is right. And I so glad you are liking the content :)
@BharatRathod-je5wx
@BharatRathod-je5wx Жыл бұрын
Excellent material for practicing SQL, thank you so much for your such fantastic tutorial.
@PriyaaWorld
@PriyaaWorld 2 жыл бұрын
Your teaching methodology is superb.... I have shared it with my husband who is looking for a course in SQL. He too found it very useful, easy to understand.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you so much 🙏🏼 Glad you liked it
@ashishgoyal4818
@ashishgoyal4818 2 жыл бұрын
This channel is very good for learning SQL, the way of explaining and displaying content is superb. If this channel could give us videos on interview questions of top companies then we won't be needing to go to other websites.
@techTFQ
@techTFQ 2 жыл бұрын
Hi Ashish , Thank you for such kind words 🙏🏼 It’s so nice to see you have liked my work and it is beneficial to you 🙂 As for interview questions, I will plan it out in the near future..
@basavarajbijali7342
@basavarajbijali7342 2 жыл бұрын
The best material for SQL in KZfaq that I have sawn, amazing blog as well, please go on such queries, which will really help many learners including myself.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Basavaraj 🙏🏼 Glad you liked it 🙂
@simplytech4u898
@simplytech4u898 2 ай бұрын
Thanks mitra khup chan shikavtoy ,mala tuza blog madhun khup kahi shikayla milale ,dhnaywad..!! select emp_id,emp_name,dept_name,salary from ( select *, min(salary) over (partition by dept_name) as min_salary, max(salary) over (partition by dept_name) as max_salary from employee ) as x where salary =x.min_salary or salary =x.max_salary
@sia_ibk
@sia_ibk 2 жыл бұрын
Hi I really enjoyed this video. I was wondering, is it possible to also use the row_number windows function to solve the third example on login frequency?
@techTFQ
@techTFQ 2 жыл бұрын
Hi Solomon, Yes you can write a query using row_number window function to solve this as well. In fact, I have posted a video on my channel giving a generic query using row number window function to fetch any no of consecutive records from a table. You can watch that video from the link below: kzfaq.info/get/bejne/btaPgt2irrDDoGg.html
@Kps225
@Kps225 2 жыл бұрын
Sir, could you please make a video on indexes and views and interview questions based on that also.. It would be really helpful and all your videos are great.. Keep rocking❤️
@techTFQ
@techTFQ 2 жыл бұрын
Thank you so much for your kind words 🙏🏼 So glad you liked my videos . Surely will consider your suggestions, let me see when I can cover these topics too..
@deanterrell4902
@deanterrell4902 2 жыл бұрын
This is the best advanced SQL video I have ever seen. Thank you very much!
@techTFQ
@techTFQ 2 жыл бұрын
Wow, thanks!
@balanced-living
@balanced-living Жыл бұрын
great job @techTFQ with your approach - blog followed by video. This is easy to follow and creates desire to solve the problem first with the concepts we know and look for your solution to improve up on it. I like your blog too. Thank you & keep doing the great work.
@mmmaxmmm83
@mmmaxmmm83 2 жыл бұрын
These are sooooo helpful. You're doing God's work!! 😁
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Maxim for such kind words man 🙏🏼 So glad I a am able to add some value through these videos ..
@AbigailSQL
@AbigailSQL 2 жыл бұрын
Thank you for this video. It's detailed and well explained. Hope to see more! I used Postgre to run the queries and it was successful, but when I tried the query for duplicate records on MSSQL, it returned an error saying (the ORDER BY clause is invalid in views...) Kindly suggest what to do.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you for liking the content 🙏🏼 These queries were written in PostgreSQL but I will soon update my blog to have corresponding queries in MySQL and Microsoft SQL server also .. may be in couple of weeks
@AbigailSQL
@AbigailSQL 2 жыл бұрын
Thank you for the response. I look forward to seeing the video.
@sandipansarkar9211
@sandipansarkar9211 2 жыл бұрын
Also finished practicing coding .Now feeling hell lot of confident in my pursuit of data analyst
@techTFQ
@techTFQ 2 жыл бұрын
That’s great buddy
@Karthikmurali-uc7ub
@Karthikmurali-uc7ub 2 жыл бұрын
Clearly understanding the way u justify each and every attributes....thank you
@ed2921
@ed2921 2 жыл бұрын
Excellent. Quick question on the temperature query, would an alternative query using self join be more concise? Rather than nested case statement. Keep up the great work.
@techTFQ
@techTFQ 2 жыл бұрын
Thanks Ed for liking the content 🙏🏼 You can always write a query on many different ways and using self join may be an option for this kind of query but if you wish to fetch any no of consecutive records then I have made another video covering it. I’ll leave a link to it below.. have a look at this generic solution as well. kzfaq.info/get/bejne/btaPgt2irrDDoGg.html
@vaibhavverma1409
@vaibhavverma1409 2 жыл бұрын
Very Complex inner join,left outer join, right outer join, with more than 3 tables,..plz post this as well
@techTFQ
@techTFQ 2 жыл бұрын
Just few hours ago I posted video about JOINS. In that I have written a query at the end where I joins multiple table using different type of joins. Do check that video out. link below: kzfaq.info/get/bejne/ZrWBfaeVmLfVgYE.html
@pushkarratnaparkhi2205
@pushkarratnaparkhi2205 2 жыл бұрын
I failed a DA interview because I was not able to solve a question similar to Query 9. But Now I am smarter than before because of you. Thanks a lot. Really very useful content
@techTFQ
@techTFQ 2 жыл бұрын
I am glad you found the video helpful bro
@infamismworldwild6248
@infamismworldwild6248 Ай бұрын
Thank you this was powerful application of SQL, partitions, lags, leads and rnks, a lot to take in and learn
@Anonymous-le2zr
@Anonymous-le2zr 2 жыл бұрын
Best channel for SQL Very well explained Appreciate your hard work !!!! Expecting similar videos to become Master in SQL Thank you very much 😊
@techTFQ
@techTFQ 2 жыл бұрын
Thanks a lot for these kind words 🙏🏼🙏🏼 I am so happy these videos are helping so many people ☺️☺️
@MaheshBabu1989
@MaheshBabu1989 2 жыл бұрын
Nice examples.. I feel writing below query for finding duplicate records is bit easier . Select user_id,user_name,email from (Select user_name,count(user_name) un from users group by user_name) asd Where asd.un>1
@techTFQ
@techTFQ 2 жыл бұрын
Thank you 🙏🏼 We can always a solve a query in several different ways and that’s the beauty of sql
@youmnaification
@youmnaification 2 жыл бұрын
You could use HAVING count >1 instead the WHERE clause. HAVING clause always works with GROUB BY.
@QuranKarreem
@QuranKarreem 2 жыл бұрын
14:35 you don't need to set condation d1.idd2.id
@anduamlaktadesse9284
@anduamlaktadesse9284 2 жыл бұрын
Big clapping !!! We desire to have such kind of tutorials on PL/SQL too! The self-join trick is really amazing, and I'm new for lead() and lag() function too.
@techTFQ
@techTFQ 2 жыл бұрын
Glad this helped bro
@Kumawatlalit912
@Kumawatlalit912 2 жыл бұрын
your doing hell lot of work (day and night ),have some rest dude, by the way awesome lesson
@techTFQ
@techTFQ 2 жыл бұрын
Thanks a lot Lalit :)
@shalinigarg859
@shalinigarg859 2 жыл бұрын
Thanks so much for step by step explanation. Really appreciated your hard work ✅
@mohammedshahil4898
@mohammedshahil4898 2 жыл бұрын
Loved this. You make it so simple to understand complex queries brother👌🏻 Keep going👏🏻
@techTFQ
@techTFQ 2 жыл бұрын
Thank you shahi … 😍 Appreciate you watching all my videos ☺️☺️
@AmirHussain-bs5un
@AmirHussain-bs5un Жыл бұрын
So much clarity in the concepts, thanks a lot!
@InspiringThings101
@InspiringThings101 Жыл бұрын
Sir, I live in the US. I am currently in the process of learning Python for professional development (and hopefully a pay upgrade) given your extensive experience, what are some courses, companies or boot camps you would recommend ? I have SQL knowledge as well as HTML and a basic understanding of Python thus far. I would love your input about this whenever. Thanks.
@rajneeshpatel5028
@rajneeshpatel5028 2 жыл бұрын
The step by step explanation of each query helped develop good grasp over the concept . Thankyou very much for the precise explanation
@techTFQ
@techTFQ 2 жыл бұрын
Your welcome bro :) Glad this helped
@ricardostefani1396
@ricardostefani1396 2 жыл бұрын
Cristal clear. Pure quality. Thanks!
@techTFQ
@techTFQ 2 жыл бұрын
Your welcome 🙏🏼 Glad you liked it
@devd5355
@devd5355 Жыл бұрын
Great approach, by far the most useful SQL video tutorial. Thanks
@rsrinivas6025
@rsrinivas6025 2 жыл бұрын
Thank you so much Sir. Please continue these complex queries as a series .
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Ramireddy 🙏🏼 Yeah will do more such videos.. Yesterday I posted another video covering 20 sql queries.. do check it out
@venkatesanr9455
@venkatesanr9455 2 жыл бұрын
Hi Toufiq, Thanks for the video and inputs. Whether we can use row number() and assign filters for greater values to fetch users who logged in consecutively as done for fetching duplicates records.
@EstherNyarkoah-v5c
@EstherNyarkoah-v5c 6 күн бұрын
Please solve more questions coz this is magical ❤😂
@somyajain411
@somyajain411 2 жыл бұрын
Thank you for explaining. One doubt What if you have not specified d1.id d2.id in Self join question (Doctor and hospital one)
@kumar8887
@kumar8887 2 жыл бұрын
This is the best video for learning how to write complex SQL queries, the way you have explained by small parts is awesome. I would like to ask you an video on SQL Loops, as In my work environment the Loop's concepts is very helpful. Please make note and try to let us know your superior knowledge on it, If time permits you!! Thank you so much for our passion of sharing knowledge..
@techTFQ
@techTFQ 2 жыл бұрын
Thanks and welcome Kumar sure will consider your request for a future video
@SHWETAYADAV-um7ol
@SHWETAYADAV-um7ol 4 ай бұрын
I am really grateful that i found your channel and it is helping me a lot. Thank you
@shashankm.s.5281
@shashankm.s.5281 2 жыл бұрын
Awesome sir.... We need more videos using advance sql concepts.... Please also try to provide videos on PL/SQL...your selection of concepts is amazing.... Please do more videos
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Shashank 🙏🏼 PL/SQL is something I may consider in future . Truly appreciate your suggestion.. so glad you liked the video☺️
@mayankbungla
@mayankbungla 2 ай бұрын
THANKS SIR THIS MADE MY WINDOWSFUNCTIONS CONCEPT MORE CLEAR
@shekhark1139
@shekhark1139 2 жыл бұрын
Your videos are really so helpful. Everytime I'm getting new concepts and tips. Thank you very much. How to update the same data for multiple columns easily ? Ex: set column1= 'SQL', column2= 'SQL' , column3='SQL' Rather than this, can we reduce code for above query ?
@chibumbamohammed5006
@chibumbamohammed5006 2 жыл бұрын
I have learnt alot from this video, I thoungh I new not until iv watched video that has proven to me something
@user-pw9mp6uk1t
@user-pw9mp6uk1t 2 ай бұрын
Thak You so much for the transcript, that is really generous of you. it's appreciated.
@ItsMeLovelyRajeshLovesRebecca
@ItsMeLovelyRajeshLovesRebecca 2 жыл бұрын
Wowowowowowowww Amazing! It is like one shot bullet entering into brain! Great Explanation! Thanks a lot! Learnt a lot! Loved it! God Bless!
@dilipsaini9860
@dilipsaini9860 Жыл бұрын
Thank you so much brother. Your video are basis for my hold on SQL.
@abdulsamadibrahim4929
@abdulsamadibrahim4929 2 жыл бұрын
Thanks a lot TFQ. Always learning new strategies on how to write SQL queries. Please, add more videos on complex SQL queries; most especially CTE, stored procedures, temp table, etc.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Ibrahim :) I am glad you have liked my contents and are learning from it. Sure, have plans to add many more such videos.
@abdulsamadibrahim4929
@abdulsamadibrahim4929 2 жыл бұрын
@@techTFQ I do not really understand the solution to question 8, Could you please explain it? Thanks.
@techTFQ
@techTFQ 2 жыл бұрын
I think couple of guys have asked the same question, Perhaps will create a short video covering it
@anandpachipala9220
@anandpachipala9220 2 жыл бұрын
your way of teaching is excellent man, soo glad to have ur content in youtube @techTFQ
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Anand 🙏🏼 It’s so glad to hear you liked it ..
@LUCAS-lu1ii
@LUCAS-lu1ii Жыл бұрын
Thank you so much, will practice this for interview.
@neelamkushwaha1703
@neelamkushwaha1703 Жыл бұрын
Hey Taufiq, your videos are really amazing.. now i have started getting hold on sql very nicely.. your way of explantion is really very nice.. Thanks for such a wonderful job
@abhishekchandrashukla3814
@abhishekchandrashukla3814 Жыл бұрын
Sir Sir Sir Sir, really really great help for giving questions for practising. Thanks a lot for this.!!
@MyAscetic
@MyAscetic 2 жыл бұрын
Great questions & thoroughly enjoyed them! Quick question regarding question #7. Don't we have to check for the condition that the days are consecutive? i.e. happen one day after the other? Here's a query I wrote and it gives the same results. Please let me know your thoughts. select x.id, x.city, x.temperature, x.day from (select *, case when datediff(day, lead(day) over (order by id)) = -1 and datediff(day, lead(day, 2) over (order by id)) = -2 then id when datediff(day, lag(day) over (order by id)) = 1 and datediff(day, lag(day, 2) over (order by id)) = 2 then id when datediff(day, lag(day) over (order by id)) = 1 and datediff(day, lead(day) over (order by id)) = -1 then id else null end as qualifying_column from weather where temperature < 0) x where x.qualifying_column is not null
@justforfunpagla
@justforfunpagla 9 ай бұрын
I think here the assumption was that the table is ordered by date, and each record corresponds to a single day.
@ritushah2059
@ritushah2059 2 жыл бұрын
Thank u so much . I checked today and solved one query. very well explained. please keep posting
Was ist im Eis versteckt? 🧊 Coole Winter-Gadgets von Amazon
00:37
SMOL German
Рет қаралды 39 МЛН
That's how money comes into our family
00:14
Mamasoboliha
Рет қаралды 11 МЛН
Looks realistic #tiktok
00:22
Анастасия Тарасова
Рет қаралды 101 МЛН
you need to learn SQL RIGHT NOW!! (SQL Tutorial for Beginners)
24:25
NetworkChuck
Рет қаралды 1,4 МЛН
Solving SQL Interview Queries | Tricky SQL Interview Queries
37:22
The 25 SQL Questions You MUST Know for Data Analyst Interviews
32:47
KSR Datavizon
Рет қаралды 199 М.