Database Reference
In-Depth Information
Figure 5-15. Using IN operator
How It Works
You specify three columns of the Address table.
select AddressID, AddressLine1, City
from Person.Address
You specify the list operator IN with the city name you want to extract records for. Hence, it filters
303 records for the provided cities only. If you scroll down, you will see that all the records will belong to
the mentioned cities only.
where City in ('Bellevue', 'Redmond', 'Seattle')
Try It: Using the NOT IN Operator
Open a New Query window in SQL Server Management Studio. Enter the following query, and click
Execute. You should see the results shown in Figure 5-16.
select AddressID, AddressLine1, City
from Person.Address
where City not in ('Bellevue', 'Redmond', 'Seattle')
 
Search WWH ::




Custom Search