Consider a table named Clients to hold information about people with the following rows:
LastName
Jones
Adams
Green
To select the columns named LastName and FirstName, use the following SELECT statement:
SELECT LastName, FirstName FROM Clients
The result of this SQL statement contains the following data:
LastName
Jones
Adams
Green
Using the SQL WHERE clause to limit the rows returned
To conditionally select data from a table, you can add a WHERE clause to the SELECT
statement resulting in the following syntax:
SELECT column_name FROM table_name WHERE column condition value
With the WHERE clause, you can use any of the following operators:
Operator
=
<>
>
<
>=
<=
BETWEEN
AND
OR
LIKE
For example, to select the columns named Last Name and First Name for Clients whose City is
Boston, use the following SELECT statement:
SELECT LastName, FirstName FROM Clients Where City = 'Boston'
FirstName
Tom
Anita
Peter
FirstName
Tom
Anita
Peter
Description
Equal
Not equal
Greater than
Less than
Greater than or equal
Less than or equal
Between an inclusive range
Joins one or more conditions
Joins one or more conditions
Specifies a search for a pattern in a column. You can use a "%" sign to
define wildcards (missing letters in the pattern) before and after the
pattern.
Address
12 State St
521 Beacon St
1 Broadway
Using a web page to list trips
City
Boston
Boston
New York
61
Need help?
Do you have a question about the COLDFUSION MX 61-GETTING STARTED BUILDING COLDFUSION MX and is the answer not in the manual?