Collection Contents Index Selecting rows from a table Compound search conditions in the WHERE clause pdf/chap12.pdf

First Guide to SQL Anywhere Studio
   PART 3. Basic SQL
     CHAPTER 12. Selecting Data from Database Tables       

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. The following example shows the use of a date inequality search condition.

  To list all employees born before March 3, 1964"
  1. Type the following:

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

emp_lname

birth_date

Whitney

1958-06-05

Cobb

1960-12-04

Jordan

1951-12-13

Breault

1947-05-13

Espinoza

1939-12-14

Dill

1963-07-19

The database server knows that the birth_date column contains a date, and converts 'March 3, 1964' to a date automatically.


Collection Contents Index Selecting rows from a table Compound search conditions in the WHERE clause pdf/chap12.pdf