Writing SQL and CFML statements to interact with a data source

After ColdFusion makes a connection to the data source, you can interact with that database by using SQL and ColdFusion.

To interact with an established data source, you must include SQL statements in your CFML statements; for example:

<cfquery name="queryname" datasource="namedbfile">
	SELECT FirstName, LastName, DepartmentID
	From Employee
</cfquery>

In this example, the first attribute of the cfquery tag is the name of the query. The second attribute of the cfquery tag defines the name of the data source. The SELECT statement defines the fields (columns) to be retrieved from a table named Employee.