A data source is needed in order for ColdFusion to communicate with a database. The data source is effectively a driver that acts as a translator for communicating SQL statements to the database back end. <cfquery> is used to prepare the SQL statements and send them through to the data source with the appropriate connection settings. <cfquery> can pass any SQL statement that the data source can handle. A record set passed back to <cfquery> is converted into a query object. The query object can be looped over for each individual record, and the values of the various columns can be output by using <cfoutput>. <cfoutput> has a group function that provides additional output options for record sets ordered by a particular column. Query variables can be manipulated and joined on the application server by using a subset of the SELECT SQL commands. Query of queries can be used to reduce the number of required lookups on any information resource that generates query variables. Record sets from disparate information resource types can be joined as required. Sample Questions
|