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 employee 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 the employees with first name John.

StepsList all employees named John:

  1. Type the following:

    SELECT *
    FROM employee
    WHERE emp_fname = 'John'
    

emp_id

manager_id

emp_fname

emp_lname

dept_id

318

1576

John

Crow

400

862

501

John

Sheffield

100

1483

1293

John

Letiecq

300

Apostrophes and case-sensitivity

Again, you can combine what you have learned:

SELECT emp_fname, emp_lname, birth_date
FROM employee
WHERE emp_fname = 'John'
ORDER BY birth_date

Notes