Differences from abstract plan derived tables  Advantages of SQL derived tables

Chapter 9: SQL Derived Tables

How SQL derived tables work

A SQL derived table is created with a derived table expression consisting of a nested select statement, as in the following example, which returns a list of cities in the publishers table of the pubs2 database:

select city from (select city from publishers) cities

The SQL derived table is named cities and has one column titled city. The SQL derived table is defined by the nested select statement and persists only for the duration of the query, which returns the following:

city
--------------------
Boston
Washington
Berkeley




Copyright © 2005. Sybase Inc. All rights reserved. Advantages of SQL derived tables

View this book as PDF