12 questions. Score 70% or more to pass this rank's quiz.
Use HAVING for conditions on aggregates, e.g. HAVING SUM(quantity) > 100; WHERE cannot reference aggregates.
NULL never equals anything, so the 12 managers drop out of the INNER JOIN; a LEFT JOIN would keep all 102.
A CROSS JOIN pairs every row with every row: 12 × 27 = 324 (one per store–product combination, like the inventory table).
COUNT(column) ignores NULLs, while COUNT(*) counts every row (102).
The LEFT JOIN keeps every customer and fills order columns with NULL when there is no match; IS NULL then keeps only those (= NULL never matches).
Both give ties the same rank; RANK then skips numbers, DENSE_RANK does not (ROW_NUMBER would give 1, 2, 3).
UNION ALL is faster because it skips the de-duplication step; use it when duplicates are impossible or wanted.
Discount is a rate (0.05 = 5%), so net sales are computed per line and then summed.
In SQL, NULL means unknown, so NULL = NULL evaluates to unknown (not true), and the row is filtered out.
Dividing two integers performs integer division; write 7.0 / 2 or CAST(7 AS REAL) / 2 to get 3.5.
Logical order is FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY; repeat the expression or use a CTE/subquery.
A CTE exists only for that statement and makes multi-step queries easier to read than nested subqueries.