Contents Index Using indexes to improve ORDER BY performance Comparing dates in search conditions

ASA Getting Started
  Selecting Data from Database Tables

Selecting rows from a table


You can limit the rows that a SELECT statement retrieves by adding a WHERE clause to your query. This is sometimes called applying a restriction to the result set. The WHERE clause includes a search condition that specifies the rows to be returned. This SELECT statement has the following syntax:

SELECT column-name-1column-name-2,...
FROM table-name
WHERE search-condition

where, as before, column-name-1, column-name-2, and table-name should be replaced with the names of the desired columns and table you are querying. The search-condition is described more below. If you use an ORDER BY clause, it must come after the WHERE clause.

List all products colored black

Notes 
Exercise 

Try some queries that combine what you have learned in this chapter. Here is one query that lists the names and birth dates of all employees named John.

SELECT ( emp_fname || ' ' || emp_lname) AS Name,
        birth_date
FROM employee
WHERE emp_fname = 'John'
ORDER BY birth_date
Name birth_date
John Letiecq 4/27/1939
John Sheffield 9/25/1955

Comparing dates in search conditions
Pattern matching in search conditions
Matching rows by sound
Using compound search conditions
Shortcuts for compound search conditions

Contents Index Using indexes to improve ORDER BY performance Comparing dates in search conditions