Writing Queries Using An Editor; Writing Queries Using Dreamweaver Mx - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

Deleting data from a database
The DELETE statement removes rows from a table. The DELETE statement has the following
syntax:
DELETE FROM table_name
[ WHERE search_condition ]
Note: There are additional options to DELETE depending on your database. For a complete syntax
description for DELETE, see the product documentation.
You can remove all rows from a table using a statement in the form:
DELETE FROM employees
Typically, you specify a WHERE clause to the DELETE statement to delete specific rows of the
table. For example, the following statement deletes John Smith from the table:
DELETE FROM employees WHERE EmpID=51
Updating multiple tables
The examples in this section all describe how to modify a single database table. However, you
might have a database that uses multiple tables to represent information.
One way to update multiple tables is to use one INSERT statement per table and to wrap all
INSERT statements within a database transaction. A transaction contains one or more SQL
statements that can be rolled back or committed as a unit. If any single statement in the
transaction fails, you can roll back the entire transaction, cancelling any previous writes that
occurred within the transaction. You can use the same technique for updates and deletes.

Writing queries using an editor

Dreamweaver MX and HomeSite+ provide a GUI for writing and executing queries. A GUI is
useful for developing and testing your queries before you insert them into a ColdFusion
application.
This section contains a brief description of these GUIs. For more information, see the
documentation on your specific tool.

Writing queries using Dreamweaver MX

This section describes how to define a query using the Dreamweaver MX Recordset dialog box,
which allows you to create a record set without having to manually enter SQL statements.
Defining a record set using this method can be as easy as selecting a database connection and table
from the pop-up menus.
To define a record set without writing SQL:
In the Dreamweaver Document window, open the page that will use the record set.
1
To open the Data Bindings panel, select Window > Data Bindings.
2
In the Data Bindings panel, click the Plus (+) button and choose Recordset (Query) from the
3
pop-up menu.
422
Chapter 19: Introduction to Databases and SQL

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents