III.3.1. Creating a New Query
A query is a request for data; it's how you ask questions of the database. For example, suppose you want to retrieve a listing of everyone in the database by first name, last name, and e-mail address. You can create and execute a query to retrieve a listing of this data.
As with most work in SQL Server 2008, you start in the SQL Server Management Studio (SSMS).
With SSMS open, the first step is to launch the Query Designer. As with most tools in Microsoft products, you can achieve your objective by using multiple methods. The following steps show one method of accessing and using the Query Designer:
Using the SSMS Object Explorer, browse to the AdventureWorks sample database within the Databases container.
Right-click the AdventureWorks2008 database and choose New Query to open a new query window.
A blank query window opens, and the SQL Editor toolbar appears, as shown in Figure 3-1. Because you create this query window from the AdventureWorks2008 database, queries in this window default to AdventureWorks2008 unless you change the context on the SQL Editor toolbar.
Figure III.3-1. The SQL Editor toolbar with context set to the Adventure Works database.
You can also click the New Query button to open a new query window. However, you're often prompted to ...