O'Reilly logo

Java™ Oracle® Database Development by David J. Gallardo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Views

SELECT statements, as we've seen—particularly in the context of their use as subqueries—can be seen as returning tables. The SQL CREATE VIEW command allows us essentially to “freeze” this table as a view. This view can then be used almost as though it were a full-fledged table.

It is important to note that a view does not capture the results of the query but rather captures the SELECT statement that created it. Changes to the underlying tables will, therefore, be reflected in the view.

Creating and Querying Views

To create a view, we use the following basic format:

CREATE VIEW AS subquery
					

The subquery can be simple or arbitrarily complex. It can be used to create a virtual table that contains a subset of data in the actual table, for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required