and no row would be eliminated by DISTINCT. To see for yourself, execute this
query:
SELECT DISTINCT Name, City
FROM Employees
The results of this code are pictured in Figure 8.8. As we expected, the DISTINCT
clause doesnt have any effect, since each row is unique.
Figure 8.8. Retrieving employees and cities
Row Filtering with WHERE
The WHERE clause is used in conjunction with SQL queries, including the SELECT
query, to deliver more refined search results based on individual field criteria.
The following example could be used to extract all employees that work in the
Department whose ID is 6:
SELECT Name, DepartmentID
FROM Employees
WHERE DepartmentID = 6
This query returns the results shown below:
Name DepartmentID
-------------------------------------------------- ------------
Ted Lindsey 6
Shane Weebe 6
302
Chapter 8: Speaking SQL

Get Build Your Own ASP.NET 2.0 Web Site Using C# & VB, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.