Chapter 9. Views
Up to this point, we've been dealing with base objects — objects that have some level of substance of their own. In contrast, this chapter goes virtual (well, mostly) to take a look at views.
Since we're assuming, in this book, that you already know something about SQL Server, I am, as I have in most of the previous chapters, going to rip through the basic part of views in more of a review approach. We will, however, be introducing some more advanced concepts — particularly in the area of partitioned and index views.
Views have a tendency to be used either too much, or not enough — rarely just right. When we're done with this chapter, you should be able to use views to:
Reduce apparent database complexity for end users
Prevent sensitive columns from being selected, while still affording access to other important data
Add additional indexing to your database to speed query performance — even when you're not using the view the index is based on
Understand and utilize the notion of partitioned tables and the early stages of federated servers (often used for very high-end scalability)
A view is, at its core, really nothing more than a stored query. You can create a simple query that selects from only one table and leaves some columns out, or you can create a complex query that joins several tables and makes them appear as one.
Get Professional SQL Server™ 2005 Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.