Previously
we had talked about the different type of Table Expressions. Usually you are
combining a table expression with another table on the left. The way to connect
the two is to use APPLY. It is possible for the table expression to access
items (columns) from the outer table.
There are
two different types of APPLY connectors. One is the CROSS APPLY. In this
scenario, a row is not returned unless there is a match on the inner Table
Expression. There is also an OUTER APPLY. It works similarly to an outer join.
It returns all rows from the left-hand side table, even if there are no matches
with the table expression. It will also return right hand side rows that match.
So far we have been talking about running
queries and dealing with data as sets. You can perform logical operators on
multiple sets. These include the UNION, INTERSECT, and EXCEPT operators. There
are certain rules that set operations must conform to. I will save that for a
future post.