Using search conditions

In this section you will learn procedures for comparing dates, using compound search conditions in the WHERE clause, pattern matching, and search condition shortcuts.

Sometimes you will not want to see information on all the employees in the Employees table. Adding a WHERE clause to the SELECT statement allows only some rows to be selected from a table.

For example, suppose you would like to look at employees with the first name of John.

StepsListing all employees named John:

  1. Type the following:

    SELECT *
    FROM Employees
    WHERE GivenName = 'John'
    

EmployeeID

ManagerID

Surname

GivenName

DepartmentID

...

318

1,576

Crow

John

400

...

862

501

Sheffield

John

100

...

1,483

1,293

Letiecq

John

300

...

Apostrophes and case-sensitivity

Again, you can combine what you have learned:

SELECT GivenName, Surname, BirthDate
FROM Employees
WHERE GivenName = 'John'
ORDER BY BirthDate

Notes