Derived table vs subquery

There are several ways to combine datasets:
  • Subquery: SELECT clause, correlation
  • Join (cross/left/right/inner/full): FROM clause, no correlation
  • Cross apply: FROM clause, correlation
Datasets retrieved in the FROM clause are called "derived tables".

The "cross apply" combines the best features of the subquery and join, but is performance-wise not always the best choice.

No comments: