Contents Index Using compound search conditions Selecting Data from Multiple Tables

ASA Getting Started
  Selecting Data from Database Tables
    Selecting rows from a table

Shortcuts for compound search conditions


Using the short form BETWEEN 

SQL has two short forms for compound search conditions. The first, BETWEEN, is used when you are looking for a range of values. For example the following two queries are equivalent:

SELECT emp_lname, birth_date
FROM employee
WHERE birth_date BETWEEN '1963-1-1' AND '1965-3-31'

and

SELECT emp_lname, birth_date
FROM employee
WHERE birth_date >= '1963-1-1'
AND birth_date <= '1965-3-31'
Using the short form IN 

The second short form, IN, may be used when looking for one of a number of values. The following two statements are equivalent:

SELECT emp_lname, emp_id
FROM employee
WHERE emp_lname IN ('yeung','bucceri','charlton')

and

SELECT emp_lname, emp_id
FROM employee
WHERE emp_lname = 'yeung'
OR emp_lname = 'bucceri'
OR emp_lname = 'charlton'

Contents Index Using compound search conditions Selecting Data from Multiple Tables