First, from the stage
For connection instructions:
1. Cartesian product
2. On filter
Interrupted: Unknown=not unknuwn missing value;
The filter (on where has) handles unknown as false, excluding the filter results. If you compare two null, the result is not equal, false
As true in a check constraint, such as requiring a column greater than 0, is successful when NULL is inserted, and null>0 is considered to be ture. If you compare two null, the result is equal, and the comparison is considered equal in unique constraints, set operations (such as union, except), sorting, grouping.
3. Add external lines (outer joins)
Second, where
You cannot use an aggregate function because it is not grouped yet, and you cannot use the column alias specified in SELECT.
Third, GROUP by
Four, having
V. Select Stage
1. Aggregation Operations
2, Discount row weight
3. Top
If an order by is not specified, the returned set is indeterminate
When with ties is specified, the last row is checked and all rows with the same value as the last row are returned.
Vi. ORDER BY
This step returns no longer a valid table, but rather a cursor, which is why the change statement cannot be used in a table expression. (Do you remember the table expression?) views, inline table-valued functions, derived tables, CTE
Exception, when used with top, as a logical finite order to get the first n, the rows returned are not ordered, and the order is not guaranteed, which requires attention.
If it is not necessary, do not easily specify an order by, perform an index scan, or execute the sort operator.
Order by considers null to be equal. At the same time, NULL is smaller than the known value and is ranked first.
Extended:
One, table operators