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

In this video, We 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.

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.

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

Link to my blog where I have posted all of these SQL Queries:

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.

Subscribe: https://www.youtube.com/@techTFQ/featured 


How to Write SQL Queries for Beginners | Practice Complex SQL Queries
2 Likes28.05 GEEK