You can use operators other than equals to select a set of rows that satisfy the search condition. The inequality operators (< and >) can be used to compare numbers, dates, and even character strings.
In Interactive SQL, execute the following query:
SELECT Surname, BirthDate FROM Employees WHERE BirthDate < 'March 13, 1964' ORDER BY BirthDate DESC;
Surname | BirthDate |
---|---|
Ahmed | 1963-12-12 |
Dill | 1963-07-19 |
Rebeiro | 1963-04-12 |
Garcia | 1963-01-23 |
Pastor | 1962-07-14 |
... | ... |
Automatic conversion to dates The SQL Anywhere database server knows that the BirthDate column contains dates, and automatically converts the string 'March 13, 1964'
to a date.
Ways of specifying dates There are many ways of specifying dates. The following are all accepted by SQL Anywhere:
'March 13, 1964' '1964/03/13' '1964-03-13'
You can tune the interpretation of dates in queries by setting a database option. Dates in the format yyyy/mm/dd or yyyy-mm-dd are always recognized unambiguously as dates, regardless of the date_order setting.
For more information on controlling allowable date formats in queries, see date_order option [compatibility], and Setting options.
Other comparison operators SQL Anywhere supports several comparison operators.
For a complete list of available comparison operators, see Comparison operators.