• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. Interacting with Databases: R... > Retrieving Information from a Databa...

Retrieving Information from a Database

ColdFusion can use data retrieved from a database to construct a Web page, send an e-mail message, or perform many other functions. To get the data out of the database, you use the CFML <cfquery> tag together with an SQL SELECT statement that specifies the data that you want to retrieve. The ColdFusion Application Server executes the <cfquery> tag and stores the database data returned to it in a special memory area called a query variable. The query variable is structured in a way that makes it easy for you to access and use the data inside it to create many types of output. The next few sections introduce you to each basic aspect of using ColdFusion to work with databases.

Composing SQL SELECT Statements

The most basic SELECT statement indicates the table containing the data you want to retrieve and the names of the fields where the data is stored. For example, the following query would retrieve the data stored in the StudentLastName and StudentFirstName fields of a table named Students:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint