26
Writing SQL
In between the begin and end
database to execute.
For example, to retrieve data from a database:
Tip
If you are using ColdFusion Studio, you can use the Query Builder to build SQL
statements by graphically selecting the tables and records within those tables that
you want to retrieve.
When the database processes the SQL, it creates a data set (a structure containing
the requested data) that is returned to ColdFusion Server. ColdFusion places the
data set in memory and assigns it the name that you defined for the query in the
attribute of the
You can reference that data set by name using the
Basic SQL syntax elements
The following sections present brief descriptions of the main SQL command
elements.
Statements
A SQL statement always begins with a SQL verb. The following keywords identify
commonly used SQL verbs:
Keyword
SELECT
INSERT
UPDATEw
DELETE
When referencing text literals in SQL, use single quotes ('). For example,
* from mytable WHERE FirstName='Russ'
which the first name is Russ.
Write a SELECT statement that lists the fields or columns that you want to select
for the query.
Follow the SELECT statement with a FROM clause that specifies the database
tables that contain the columns.
cfquery
Description
Retrieves the specified records
Adds a new row
Changes values in the specified rows
Removes the specified rows
tags, write the SQL that you want the
cfquery
tag.
Chapter 3 Querying a Database
selects every record from mytable in
tag later on the page.
cfoutput
Select
name
Need help?
Do you have a question about the COLDFUSION 5-DEVELOPING and is the answer not in the manual?
Questions and answers