Chapter 5. Table Expressions

A table expression is a named query expression that represents a valid relational table. You can use table expressions in data manipulation statements much like you use other tables. Microsoft SQL Server supports four types of table expressions: derived tables, common table expressions (CTEs), views, and inline table-valued functions (inline TVFs), each of which I describe in detail in this chapter. The focus of this chapter is using SELECT queries against table expressions; Chapter 8, covers modifications against table expressions.

Table expressions are not physically materialized anywhere—they are virtual. When you query a table expression, the inner query gets unnested. In other words, the outer query and the inner ...

Get Microsoft® SQL Server® 2012 T-SQL Fundamentals now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.