Database Reference
In-Depth Information
How It Works
You specify three columns of the Address table.
select AddressID, AddressLine1, City
from Person.Address
You specify the range operator BETWEEN with the range of AddressID you want to include the records
for. Hence, it filters 200 records for the address, ranging not between 201 and 32521, in other words, a
total of 200 records.
where AddressID between 201 and 32521
Finding NULL Values
Null values are undefined and unknown values and represented by the NULL keyword. When executing
queries, it becomes important sometimes to extract NULL and NOT NULL rows separately. To support this
purpose, SQL Server provides IS NULL and its negation IS NOT NULL to be included with the WHERE
condition clause.
Try It: Using IS NULL 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-19.
select Title, FirstName, MiddleName, LastName
from Person.Contact
where MiddleName is null
How It Works
You specify four columns of the Contact table.
select Title, FirstName, MiddleName, LastName
from Person.Contact
You specify the WHERE condition based on whether MiddleName is null. Hence, it filters 8,499 records
for the person's contact details; all the listed records have their MiddleName as NULL .
where MiddleName is null
 
Search WWH ::




Custom Search