II.4.4. Creating Views

Although they're not tables per se, views have many of the same behavioral traits and features of tables. You can find much more about views in Book III, Chapter 8; however, it's worth a small detour at this point to see how to use the SQL Server Management Studio to create and inspect these helpful structures.

At its core, a view appears to be a virtual table that is made of one or more underlying tables. In fact, views can even include other views, functions, and synonyms. Database designers create views to help address many common challenges, such as

  • Simplifying complex queries

  • Working around security requirements

  • Abstracting underlying database structures

  • Reducing traffic between application server and database server, or the user and database server

After you create a view, it's available to be used by other users and applications. Sophisticated database-driven applications often utilize views heavily. Here's how to create a view and set its properties in the SQL Server Management Studio:

  1. Launch the SQL Server Management Studio.

  2. Connect to the appropriate SQL Server instance.

  3. Expand the connection's entry in the Object Explorer view.

  4. Expand the Databases folder.

  5. Right-click the Views folder and choose New View.

    You're presented with a dialog box, as shown in Figure 4-14.

    Figure II.4-14. The preliminary dialog box for creating a view in the SQL Server Management Studio.
  6. Select the tables that will make up your view.

    You can hold down the Ctrl key to select multiple ...

Get Microsoft® SQL Server™ 2008 All-In-One Desk Reference For Dummies® 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.