System information

132 Chapter 12: Lesson 9: Enabling Database Maintenance
For example, the database table named Clients contains information about people in the
following rows:
To add a record to the table, use the following statement:
INSERT INTO Clients
VALUES ('Smith', 'Kaleigh', '14 Greenway', 'Windham')
After the database management system processes the preceding statement, the table contains the
following rows:
Notice that the values inserted in the table were surrounded by single-quotation marks in the
statement. In SQL, you must surround any text or date values with single-quotation marks;
however, you dont use single-quotation marks with numeric values.
Alternatively, you can specify the columns for which you want to insert data. This approach lets
you insert data into some columns while omitting others. For this approach, you use the
following syntax:
INSERT INTO table_name (column1, column2,...)
VALUES (value1, value2,....)
For example, to add Kaleigh Smith of Windham, with an unknown address, you use the named
column approach:
INSERT INTO Clients (LastName, FirstName, City)
VALUES ('Smith', 'Kaleigh', 'Windham')
You use the cfquery tag to execute SQL from ColdFusion. The cfquery tag passes SQL
statements to your data source. As described in “Lesson 2: Configuring Your
Development Environment” on page 49, a data source stores information about how to connect
to an indicated data provider, such as a relational database management system. The data source
that you established in that chapter stored information on how to access the Compass Travel
database. The data source name was “CompassTravel.
LastName FirstName Address City
Tom Jones 12 State St Boston
Peter Green 1 Broadway New York
LastName FirstName Address City
Tom Jones 12 State St Boston
Peter Green 1 Broadway New York
Smith Kaleigh 14 Greenway Windham