Comparing dates in queries

Sometimes you will not know exactly what value you are looking for, or you would like to see a set of values. You can use comparisons in the WHERE clause to select a set of rows that satisfy the search condition.

Listing employees born before March 3, 1964

The following example shows the use of a date inequality search condition. Type the following:

SELECT emp_lname, birth_date
FROM employee
WHERE birth_date < 'March 3, 1964'

emp_lname

birth_date

Whitney

1958-06-05 00:00:00.000

Cobb

1960-12-04 00:00:00.000

Jordan

1951-12-13 00:00:00.000

Breault

1947-05-13 00:00:00.000

Espinoza

1939-12-14 00:00:00.000

Dill

1963-07-19 00:00:00.000

Sybase IQ knows that the birth_date column contains a date, and converts 'March 3, 1964' to a date automatically.