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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.