Complex SQL Query Breakdown Step By Step

  Рет қаралды 14,363

Database Star

Database Star

Күн бұрын

📝 Get my free SQL Cheat Sheets: www.databasestar.com/get-sql-...
🎓 Learn and become confident in SQL: databasestar.mykajabi.com/sql...
When you work with SQL you may come across a query that seems quite complex. It could have many tables and joins, many columns, functions, subqueries, and more features you may or may not have heard of.
In this video, I'll show you how to understand a complex query. We will
- start with a complex SQL query
- improve the formatting of it
- create a diagram of the tables and columns
- run parts of the query
- add comments
At the end of this process, we'll be able to understand and describe what the query does.
You can follow this kind of process for your own complex query.
⏱ TIMESTAMPS:
00:00 Intro
00:40 Our query
01:31 Formatting the query
02:51 Create a diagram
09:46 View the table data
11:01 Run subqueries
12:38 Add comments
13:38 Run the main query
🔗 VIDEO LINKS:
Sample SQL: github.com/bbrumm/databasesta...

Пікірлер: 30
@baruchben-david4196
@baruchben-david4196 3 ай бұрын
I have to say that your explanations are clear and informative, well-organized. Thank you. You've helped break a difficult subject into bite-sized pieces I can handle.
@DatabaseStar
@DatabaseStar 3 ай бұрын
Thanks very much for the kind words! That’s what I am aiming for with my videos, so it’s good to hear it’s been achieved!
@maxyudin
@maxyudin Жыл бұрын
I'm self-taught in SQL, and I use simple queries because that's all I need to achieve my goals. But I've missed this kind of explanation in my past when I googled tutorials that were faintly intelligible and confusing. Been subscribed for a while now and have watched a couple dozen of your videos. Thanks for your work!
@DatabaseStar
@DatabaseStar Жыл бұрын
Thanks for sharing, glad you found my videos helpful!
@punkyM637
@punkyM637 Жыл бұрын
Thank you for all your videos!! I thoroughly enjoy them
@DatabaseStar
@DatabaseStar Жыл бұрын
No problem, glad you like them!
@WestCoastKop
@WestCoastKop Жыл бұрын
Fantastic tutorial, it's really helpful to understand how to break down the subqueries and visualize each table/column
@DatabaseStar
@DatabaseStar Жыл бұрын
Thanks, glad you found it helpful!
@kvanniekerk3792
@kvanniekerk3792 Жыл бұрын
Brilliant explanation, thank you. I have recently started getting more invested in understanding data and how SQL works to aid that journey. Complex queries have till now intimidated me, but your explanation made perfect sense and is actually a logical yet simple way to decompose a complex query to its constituent parts. Thank you indeed. I was thinking of using a UML diagram to replace your diagram boxes as then I can see the structure clearer.
@DatabaseStar
@DatabaseStar Жыл бұрын
Thanks for the comment! I'm glad you found it helpful. A UML diagram would also be helpful as you suggested.
@patyue5012
@patyue5012 Жыл бұрын
Nice content! Thanks.
@DatabaseStar
@DatabaseStar Жыл бұрын
Glad you like it!
@sabuein
@sabuein Жыл бұрын
Thank you.
@DatabaseStar
@DatabaseStar Жыл бұрын
You're welcome!
@oracle_professor
@oracle_professor Жыл бұрын
Excellent work Database Star
@DatabaseStar
@DatabaseStar Жыл бұрын
Thanks!
@attaullahkhan2504
@attaullahkhan2504 Жыл бұрын
Kindly make more videoa like this... thanks in advance.
@DatabaseStar
@DatabaseStar Жыл бұрын
Thanks, sure I can do that.
@kumarmv-lo1rm
@kumarmv-lo1rm Жыл бұрын
I was looking for something like this. This really helps. Thanks. Is it possible to do one with the with clause and unions and joins all together.
@DatabaseStar
@DatabaseStar Жыл бұрын
Glad it's helpful! Sure I can do one with a with clause, unions, and joins.
@jorso163
@jorso163 Жыл бұрын
Sir,when i am exporting data i couldn't see the ongoing exporting details in Oracle SQL developer like how many rows exporting is going on like this and how to enable this ,please help me
@DatabaseStar
@DatabaseStar Жыл бұрын
I'm not sure why that would be happening. I assume it's something that should happen by default.
@rustyspottedcat8885
@rustyspottedcat8885 Жыл бұрын
Its all about ... sets of all sets ... that doesnt contain themselves.
@DatabaseStar
@DatabaseStar Жыл бұрын
That's a good point!
@ai-oo9ls
@ai-oo9ls Жыл бұрын
i just started learning sql, i want to ask when should i use procedure ?
@DatabaseStar
@DatabaseStar Жыл бұрын
I've got another video on using stored procedures on my channel, ("Store procedures are better than raw SQL") which has some more detail, but there are a few advantages: easier design if there are many people or applications accessing a database, better to handle complex logic that can't be done in a regular SQL statement.
@Learn_IT_with_Azizul
@Learn_IT_with_Azizul 8 ай бұрын
very important content but sound is so low... plz have a look. ty
@DatabaseStar
@DatabaseStar 8 ай бұрын
The sound seems fine in this video when i compare it to other videos on KZbin. My older videos had low sound because my old microphone but this one should be OK.
@Myself_9037
@Myself_9037 11 ай бұрын
I have a doubt. I have table with two fields, one field is array in table 1 uID | Contact 2 | 1221,1223 3 | 1123 Now value of 1221 and 1223 are in table Two. I want a query to join table 1 and table 2 using array of field2
@DatabaseStar
@DatabaseStar 11 ай бұрын
I'm not sure I fully understand the issue, but I think you could join the two tables together based on common values.
When to Use a Subquery in SQL
8:50
Database Star
Рет қаралды 31 М.
Playing hide and seek with my dog 🐶
00:25
Zach King
Рет қаралды 31 МЛН
THEY made a RAINBOW M&M 🤩😳 LeoNata family #shorts
00:49
LeoNata Family
Рет қаралды 42 МЛН
50 YouTubers Fight For $1,000,000
41:27
MrBeast
Рет қаралды 186 МЛН
6 SQL Joins you MUST know! (Animated + Practice)
9:47
Anton Putra
Рет қаралды 124 М.
7 Database Design Mistakes to Avoid (With Solutions)
11:29
Database Star
Рет қаралды 68 М.
Complex SQL Query: Watch Me Write It
15:10
Database Star
Рет қаралды 6 М.
Learn & Practice SQL Complex Queries | 10 examples (Must DO for Interviews)
52:42
Complex SQL Breakdown (CTEs, Subquery, and More)
22:14
Database Star
Рет қаралды 3,2 М.
Solving SQL Interview Queries | Tricky SQL Interview Queries
37:22
Как удвоить напряжение? #электроника #умножитель
1:00
Hi Dev! – Электроника
Рет қаралды 939 М.
Top 50 Amazon Prime Day 2024 Deals 🤑 (Updated Hourly!!)
12:37
The Deal Guy
Рет қаралды 1,4 МЛН
Копия iPhone с WildBerries
1:00
Wylsacom
Рет қаралды 2,8 МЛН