Table Expressions
In this chapter’s opening paragraphs, I mentioned that there might be cases in which you need "logical" temporary tables–that is, only virtual materialization of interim sets, as opposed to physical materialization in temporary tables and table variables. Table expressions give you this capability. These include derived tables, CTEs, views, and inline table-valued UDFs. Here I’ll point out the scenarios in which these are preferable compared with other temporary objects and provide an example.
You should use table expressions in cases where you need a temporary object mainly for simplification–for example, when developing a solution in a modular approach, a step at a time. Also, use table expressions when you need to access the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access