You can query databases to retrieve data at run-time. When retrieving data from a database:
- You use the CFQUERY block tag on a page to tell ColdFusion what and how to connect to a database and how to store the retrieved data.
- You write SQL commands inside the CFQUERY block to specify the data that you want to retrieve from the database.
- The retrieved data is stored on that page as a query variable.
- You can reference the query variable data on that page in a CFOUTPUT block to use its values.