Database Reference
In-Depth Information
Figure 5-3. Selecting specific columns
Using the WHERE Clause
Queries can have WHERE clauses. The WHERE clause allows you to specify criteria for selecting rows. This
clause can be complex, but we'll stick to a simple example for now. The syntax is as follows:
WHERE <columnl> <operator> <column2 / Value>
Here, <operator> is a comparison operator (for example, =, <> , >, or <). (Table 5-1, later in the
chapter, lists the T-SQL comparison operators.)
Try It: Refining Your Query
In this exercise, you'll see how to refine your query.
1. Add the following WHERE clause to the query in Figure 5-3:
Where City = 'Redmond'
2. Run the query by pressing F5, and you should see the results shown in
Figure 5-4.
 
Search WWH ::




Custom Search