Understanding Column Aliases

In the introduction to SQL in Day 5, you learned that when you use <CFQUERY> to select records from a datasource, the selected records are returned as variable values corresponding to the field names in your table. Take a look at a sample Microsoft Access table in Figure 19.1.

Figure 19.1. A sample database table in Microsoft Access, designed and named with ColdFusion in mind.

If you've already read Day 2, "Anatomy of a ColdFusion Application," you'll remember this same table from some of the examples there. To access records in this table, you might use a query like this:

 <CFQUERY NAME="get_songs" DATASOURCE="elvis"> ...

Get Sams Teach Yourself ColdFusion® in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.