ASA Getting Started
Selecting Data from Database Tables
Selecting rows from a table
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.
List all employees born before March 13, 1964
In Interactive SQL, type the following in the SQL Statements pane:
SELECT emp_lname, birth_date FROM employee WHERE birth_date < 'March 13, 1964' ORDER BY birth_date DESC
emp_lname | birth_date |
---|---|
Ahmed | 12/12/1963 |
Dill | 7/19/1963 |
Rebeiro | 4/12/1963 |
Garcia | 1/23/1963 |
Pastor | 7/14/1962 |
... | ... |
Automatic conversion to dates The Adaptive Server Anywhere database server knows that the birth_date 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 Adaptive Server 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 information on controlling allowable date formats in queries, see DATE_ORDER option [compatibility], and Setting options.
Other comparison operators For a complete list of available comparison operators, see Comparison operators.