A complex SQL query is one that pulls data from more than one table, filters it in several ways, groups it, or nests one query inside another. Instead of asking a single simple question like "list all customers," complex queries answer layered business questions such as "which product categories had average order values above a certain amount last quarter, and which sales representatives handled them?" The answer lives across multiple related tables, so you need JOINs, WHERE and HAVING conditions, GROUP BY with aggregate functions, and sometimes subqueries, all working together in one statement.
This topic sets the foundation for the rest of the module. Before you can write a complex query confidently, you need a clear mental model of how relational tables connect through primary and foreign keys, and you need to understand the order in which SQL clauses are evaluated. That execution order explains, for example, why WHERE filters individual rows before grouping while HAVING filters groups after aggregation. Recognizing the core building blocks also makes long queries far less intimidating: almost every large query is a collection of familiar small pieces.
As you watch the videos below, look for the progression from a simple SELECT to a multi-table, multi-clause statement. Pay attention to how experienced developers break a query apart, test one piece at a time, and build upward rather than typing the whole thing at once. Try to identify each clause by name and ask yourself what it contributes to the final result set.
This video takes an existing complex SQL query and walks through it step by step, decomposing it into its individual clauses and explaining what each part contributes. Based on the title and the channel's focus, expect coverage of joins across multiple tables, filtering conditions, grouping and aggregation, and nested subqueries as they appear within a single statement. The emphasis is on reading and interpreting a large query rather than memorizing syntax.
Database Star is a well-established SQL teaching channel, and this breakdown approach directly supports the subtopics on core building blocks and the progression from simple to complex queries.
In this shorter video the presenter writes a complex query live, narrating the decisions made at each step. You should see how a question stated in plain language is translated into table selections, join conditions, filters, and aggregations, with the query built and tested incrementally rather than all at once.
Watching a query being composed in real time models the problem-solving workflow behind complex SQL and complements the previous video's focus on reading finished queries.
This beginner tutorial covers the fundamentals of SQL in a compact format, including the basic SELECT statement and how queries retrieve data from a relational database. It is the first part of a three-part business intelligence series and includes a downloadable SQLite database and query files so you can follow along hands-on.
It refreshes the simple-query baseline and relational table structure that complex queries build upon, making it a useful starting point if your SQL is rusty before tackling multi-table work.
Together these videos establish the vocabulary and structural understanding needed for the module outcomes. The beginner tutorial grounds you in relational structure and basic SELECT and WHERE filtering (MO2), while the two Database Star videos show joins across multiple tables (MO1), grouping with aggregate functions and HAVING conditions (MO3, MO4), and subqueries embedded within a larger statement (MO5). Most importantly, both complex-query videos demonstrate the decomposition habit of reading and building a query clause by clause, which is the skill you will apply throughout the remainder of this module.
These videos were chosen from YouTube on October 2, 2026. Each has captions; the player turns them on. Videos on YouTube can be changed or removed — if one no longer plays, tell your instructor. If a player does not appear, use its Watch on YouTube link.
Relational databases deliberately split information across multiple tables to avoid duplication: customers live in one table, orders in another, products in a third. That design keeps data clean, but it means almost every useful question you ask will require pulling columns from more than one table at a time. JOINs are the SQL mechanism that makes this possible, matching rows from one table to rows in another based on a shared key.
In this topic you will work through the four primary JOIN types. An INNER JOIN returns only rows that have a match on both sides. A LEFT JOIN keeps every row from the left table and fills in NULLs where no match exists on the right; a RIGHT JOIN does the mirror image; and a FULL JOIN preserves unmatched rows from both tables. The differences matter enormously in practice — the same query written with INNER instead of LEFT can silently drop the customers who have not yet placed an order, which is often exactly the group you were trying to count.
As you watch the videos below, pay close attention to three things: the join condition (the ON clause and which columns it compares), where NULLs appear in the result set and why, and how table aliases keep multi-table queries readable. When a video shows a diagram or animation, try to connect the picture back to the actual rows in the result table rather than memorizing the shape alone. Then practice writing the queries yourself — JOIN syntax becomes intuitive quickly once you have typed a dozen of them.
A guided walkthrough of SQL JOINs with worked examples, covering what a JOIN does and how the major types differ in the rows they return. Based on the title and channel, expect coverage of INNER, LEFT, RIGHT and FULL joins with sample tables and result sets, plus the ON clause syntax that drives the match.
Database Star is a well-established SQL instruction channel, and at roughly 11 minutes this video gives enough room to treat each JOIN type properly rather than rushing — making it a solid primary overview for the first six subtopics.
An animated tour of six JOIN variations, including the four core types plus additional forms such as cross and self joins. The description includes Docker and SQL commands so you can spin up a database and run the same statements yourself while watching.
The animations make the matched-versus-unmatched row behavior visually concrete, which is the single hardest idea in this topic, and the included practice commands let you verify each JOIN's output with your own hands.
A short, focused lesson on extending JOIN syntax beyond two tables, showing how to chain multiple JOIN clauses in a single SELECT statement. Expect discussion of the order in which tables are joined and how each successive ON condition links back to the growing result set.
This directly addresses the Writing Multi-Table Queries with JOINs subtopic, which the two-table examples do not fully cover, and it comes from the same instructor as the overview video so the notation stays consistent.
Together these three videos map closely onto MO1. The Database Star overview and the animated comparison both lay out INNER, LEFT, RIGHT and FULL JOIN side by side so you can distinguish them by the rows each returns, while the examples in all three videos model the judgment of choosing the appropriate JOIN for a given retrieval scenario. The three-table video then extends that skill from pairs of tables to the realistic multi-table queries this module expects you to write. These videos are deliberately scoped to JOINs; the filtering and aggregation outcomes (MO2 through MO5) are addressed by the other resources in this module, though you should expect WHERE clauses to appear alongside the JOIN examples here.
These videos were chosen from YouTube on October 2, 2026. Each has captions; the player turns them on. Videos on YouTube can be changed or removed — if one no longer plays, tell your instructor. If a player does not appear, use its Watch on YouTube link.
Every SQL query you write returns rows, but rarely do you want all of them. The WHERE clause is the mechanism that lets you state, precisely and declaratively, which rows qualify: customers in a particular region, orders above a dollar threshold, product names that begin with a certain prefix, or records where a value was never recorded at all. Understanding WHERE is the foundation for nearly everything else in this module, because joins, grouped summaries, and subqueries all depend on your ability to express conditions accurately.
In this topic you will work through the building blocks one at a time: the basic structure of a WHERE clause, the comparison operators (=, <>, <, >, <=, >=, BETWEEN), the logical operators AND, OR, and NOT, pattern matching with LIKE and its wildcards, set membership with IN and NOT IN, and the special handling that NULL requires through IS NULL and IS NOT NULL. The last subtopic ties these together: combining several conditions in one predicate, where operator precedence and parentheses determine whether your query means what you think it means.
As you watch the videos below, pay attention to the exact syntax used, especially how string literals are quoted, how wildcards (% and _) behave, and why NULL cannot be tested with the equals sign. Try pausing and predicting which rows a given condition will return before the presenter runs the query — that habit is what turns syntax recognition into real query-writing skill.
This installment of Microsoft's T-SQL beginner series focuses on sorting and filtering query results, so it should cover the WHERE clause in the context of a full SELECT statement along with ORDER BY. Expect demonstrations of filtering conditions written in Transact-SQL against sample tables, likely including comparison operators and ways to restrict which rows are returned.
It comes directly from Microsoft Developer, so the syntax and terminology match the SQL Server/T-SQL dialect authoritatively, and placing WHERE alongside sorting shows how filtering fits into the overall shape of a query rather than in isolation.
A tutorial that introduces the SELECT statement together with the WHERE clause and walks through SQL operators with worked examples. Based on its title and placement in a full SQL course playlist, it should demonstrate comparison and logical operators used inside filter conditions on sample data.
It is an entry-level, example-driven treatment that maps closely to the first three subtopics (introduction to WHERE, comparison operators, and AND/OR/NOT), making it a good first pass before you tackle the more specialized operators.
This tutorial concentrates on three specific SQL Server operators used inside WHERE conditions: IN for set membership, BETWEEN for ranges, and LIKE for pattern matching. The description indicates it demonstrates how to apply each operator to write more targeted queries.
It gives dedicated coverage to the IN/NOT IN and LIKE-with-wildcards subtopics that shorter introductory videos often mention only briefly, and the range operator BETWEEN is a natural companion to the comparison operators you will already have seen.
These three videos together support MO2 most directly: the Microsoft Developer and Rishabh Mishra videos establish WHERE clause structure, comparison operators, and the logical operators AND, OR, and NOT, while the Tech Yatra tutorial extends that foundation to IN, BETWEEN, and LIKE pattern matching. Together they give you the operator vocabulary needed to filter rows precisely before joining tables (MO1), to recognize that WHERE acts on individual rows prior to grouping — the distinction you will need for MO3 and MO4 — and to write the conditions that later host subqueries in the WHERE clause (MO5). Note that NULL handling with IS NULL and IS NOT NULL may receive limited attention in these videos, so review the course readings on that subtopic to complete your coverage.
These videos were chosen from YouTube on October 2, 2026. Each has captions; the player turns them on. Videos on YouTube can be changed or removed — if one no longer plays, tell your instructor. If a player does not appear, use its Watch on YouTube link.
A SELECT statement returns a set of rows, and unless you say otherwise, the database makes no promise about the order in which those rows come back. The ORDER BY clause is how you take control of that sequence, telling the database to present results sorted by one or more columns, ascending or descending. It is the last major clause evaluated in a query, which is why it can reference column aliases and even column positions that earlier clauses cannot.
In this module you are building complex queries with joins, grouping, and subqueries. Sorting is what makes those results readable and usable: a grouped sales summary is far more informative when ordered from highest total to lowest, and a filtered customer list is easier to scan when ordered by last name then first name. You will also see that sorting behaves differently depending on data type — numbers sort numerically, text sorts by collation rules, and dates sort chronologically — and that NULL values need special attention.
As you watch, pay attention to the exact syntax (ASC is the default and can be omitted, DESC must be stated explicitly), to how a second or third sort column acts as a tiebreaker, and to how sorting interacts with row limits such as LIMIT or TOP. Also note where sorting by column position is convenient and where it becomes fragile if the SELECT list changes.
A beginner-oriented walkthrough of the ORDER BY clause that, based on its title and description, steps through sorting in ascending order, descending order, and across multiple columns. Expect demonstrations of the basic syntax and how the sort direction keyword attaches to each column individually.
It maps directly onto the core subtopics here — purpose of ORDER BY, ASC, DESC, and multi-column sorting — and its slow, beginner-friendly pacing makes it a good first watch before the more advanced material.
This follow-up video from the same channel addresses ORDER BY in more complicated situations: how sorting applies to the combined result of a UNION, how it interacts with LIMIT or TOP to produce top-N results, and how NULL values are positioned in a sorted list. These are the scenarios where sorting behavior commonly surprises students.
It extends the basics into the complex-query context of this module and covers the NULL and data-type edge cases that the topic summary calls out, which simple tutorials usually skip.
A widely viewed introductory SQL lesson that covers the fundamentals of writing queries against a sample database, including SELECT, filtering, and sorting output. It is the first part of a three-part beginner series using a downloadable SQLite database and query files so you can follow along hands-on.
With millions of views and a well-established business-intelligence instructor, it provides a reliable refresher that places ORDER BY in the context of a full query, which is useful if your SELECT and WHERE skills feel rusty before tackling the sorting specifics.
These videos reinforce the module outcomes by showing how the final presentation step of a query fits with the clauses you are constructing. Sorted output makes the results of JOIN queries (MO1) and WHERE filters (MO2) readable and verifiable, and ordering an aggregated result set is how GROUP BY and HAVING summaries become meaningful rankings (MO3, MO4). The advanced video's treatment of ORDER BY with UNION, LIMIT/TOP, and NULLs supports the multi-step query construction expected in MO5, where a correctly ordered and limited result is often the point of the subquery in the first place.
These videos were chosen from YouTube on October 2, 2026. Each has captions; the player turns them on. Videos on YouTube can be changed or removed — if one no longer plays, tell your instructor. If a player does not appear, use its Watch on YouTube link.
Up to this point, most of your queries have returned individual rows. GROUP BY changes that perspective: instead of looking at each row on its own, you collapse rows that share a common value into a single summary row. Combined with aggregate functions such as COUNT, SUM, AVG, MIN, and MAX, GROUP BY lets you answer questions like "how many orders did each customer place?" or "what is the average salary in each department?" — the kind of statistical summaries that turn raw stored data into useful information.
HAVING is the companion clause that filters those summary groups. A common source of confusion is why you cannot simply put an aggregate condition in WHERE, and the answer lies in query execution order: WHERE filters individual rows before grouping happens, while HAVING filters the groups after the aggregates have been calculated. Keeping that sequence straight (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY) is the single most helpful mental model for this topic, and it is also exactly what the module outcomes ask you to be able to explain.
As you watch the videos below, pay attention to three things: which columns appear in the SELECT list versus the GROUP BY list, where each example places a filtering condition and why, and how the final query reads from top to bottom once GROUP BY and HAVING are combined. Try pausing and predicting the result set before the presenter runs the query — that habit will prepare you well for the module assignments.
A concise introduction from Database Star explaining what the GROUP BY clause does and how to write it, likely using short worked examples that pair GROUP BY with aggregate functions. At roughly five minutes, it focuses on the core mechanics rather than edge cases, making it a good first exposure to the clause.
It directly addresses the "Purpose of GROUP BY" and "Common Aggregate Functions" subtopics in a compact, beginner-friendly format, and Database Star is a well-established channel dedicated specifically to SQL and database instruction.
Part 6 of Microsoft's Transact-SQL beginner series, this video covers using functions in T-SQL and then grouping aggregated results. Expect demonstrations in a real SQL Server environment showing how aggregate functions are applied and how GROUP BY organizes their output.
It comes directly from Microsoft Developer, so the syntax and terminology are authoritative, and its emphasis on aggregated results supports the subtopics on aggregate functions and writing combined grouping queries in a practical, hands-on setting.
Part of Rishabh Mishra's SQL tutorial series, this lesson treats GROUP BY and HAVING together, which is how they are most often used in practice. Based on its title and placement in a full course playlist, it should walk through grouping examples and then demonstrate filtering those groups with HAVING. Note that the narration is in Hindi with English SQL terminology and on-screen code.
It is the only video of the three that explicitly pairs HAVING with GROUP BY, making it the best match for the subtopics on filtering groups, distinguishing WHERE from HAVING, and writing combined queries.
Together these videos target MO3 and MO4 most directly. The Database Star and Microsoft Developer videos build the foundation for MO4 by showing how GROUP BY organizes rows and how aggregate functions summarize them, with Microsoft's lesson adding practical demonstration in a live database environment. The Rishabh Mishra tutorial extends this to HAVING, giving you the side-by-side treatment of grouping and group-level filtering needed to compose complete GROUP BY/HAVING queries and to articulate, as MO3 requires, that WHERE filters rows before aggregation while HAVING filters groups after it. The grouped result sets you build here also set up the subquery work in MO5, since aggregate summaries are frequently used as inputs to nested queries.
These videos were chosen from YouTube on October 2, 2026. Each has captions; the player turns them on. Videos on YouTube can be changed or removed — if one no longer plays, tell your instructor. If a player does not appear, use its Watch on YouTube link.
A subquery is simply a SELECT statement nested inside another SQL statement. Instead of running one query, writing down the result, and then typing a second query that uses that result, you let the database do both steps at once. The inner query runs and hands its result to the outer query, which uses it as a value, a list of values, or even a temporary table.
Where you place the subquery determines what it does. In the WHERE clause, a subquery supplies values to filter on, often with operators such as =, IN, >, or ALL/ANY. In the FROM clause, it acts as a derived table — a result set you can join to or filter like any other table. In the SELECT clause, a scalar subquery returns exactly one value per row, useful for adding a computed column such as a count or an average. You will also meet correlated subqueries, which reference a column from the outer query and therefore re-evaluate for each outer row, and the EXISTS / NOT EXISTS operators, which test whether a subquery returns any rows at all.
As you watch the videos below, pay attention to three things: where the subquery sits in the statement, how many rows and columns it is allowed to return in that position, and whether it depends on the outer query (correlated) or can run on its own (non-correlated). Try pausing and predicting the result before the presenter reveals it, and notice when a subquery could have been written more simply as a JOIN — that judgment is part of good practice.
Database Star explains what a subquery is and, more importantly, when reaching for one makes sense. The video works through a straightforward query and then transforms it into a subquery version, so you can see the before-and-after side by side. Expect discussion of the reasoning behind choosing a subquery over an alternative formulation.
It frames the 'What Is a Subquery?' and 'Best Practices' subtopics directly, and Database Star is a well-established SQL teaching channel known for clear, accurate explanations aimed at learners.
A longer tutorial that walks through SQL subqueries step by step with worked examples, including the distinction between single-row and multi-row subqueries. The extended runtime allows the presenter to demonstrate several query patterns rather than just one, which helps you see how subquery results feed the outer statement.
The single-row versus multi-row distinction is exactly what governs which operators you can use in the WHERE clause, making this a practical companion to the placement subtopics and to writing subqueries you can run yourself.
A short, focused demonstration of the SQL EXISTS operator in SQL Server, showing how EXISTS tests whether a subquery returns any rows rather than comparing values. At three minutes it is a targeted reference clip rather than a full lesson, so use it alongside the longer videos.
EXISTS and NOT EXISTS are their own subtopic and are easy to confuse with IN; this concise clip isolates the operator so the behavior is clear, and it naturally illustrates the correlated subquery pattern that EXISTS usually relies on.
Together these three videos target MO5 most directly: students see subqueries defined, placed in different clauses, and evaluated for whether they return one row or many, which is the core skill of composing a subquery to solve a multi-step retrieval problem in a single statement. Because subqueries in the WHERE clause depend on comparison and membership operators such as =, IN, and EXISTS, the videos also reinforce the filtering skills in MO2, and the comparisons between subquery and non-subquery formulations connect back to the JOIN decisions in MO1. Viewing them in order — concept and purpose, worked examples, then the EXISTS special case — builds from understanding to construction.
These videos were chosen from YouTube on October 2, 2026. Each has captions; the player turns them on. Videos on YouTube can be changed or removed — if one no longer plays, tell your instructor. If a player does not appear, use its Watch on YouTube link.