Database Reference
In-Depth Information
Try It: Writing an Enhanced Query
In this example, you'll code a query that uses the basic syntax just shown. You want to do the following:
•
Select all the addresses that are in Redmond.
•
Display only AddressID, AddressLine1, City.
•
Sort the addresses by the AddressID.
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-6.
Select AddressID, AddressLine1, City from Person.Address
Where City= 'Redmond'
Order By AddressID Asc
Figure 5-6.
Filtering and sorting data