Exploring the Basics of the SELECT Statement

SELECT statements give SQL its seemingly magical powers. They do this by giving ColdFusion the capability to find a specific record or set of records based on criteria you choose.

Let's start with a sample table. In Table 5.1, I've reproduced the contents of the songs table from my database of Elvis trivia.

Table 5.1. songs
ID Title Released Rating
1 Baby, Let's Play House 1954 yeee-haw!
2 Good Rockin' Tonight 1954 yeee-haw!
3 Money Honey 1956 yeee-haw!
4 Teddy Bear 1957 OK, I guess
5 A Big Hunk O'Love 1959 OK, I guess
6 Bossa Nova Baby 1963 uh-oh
7 Devil In Disguise 1963 yeee-haw!
8 Do The Clam 1965 uh-oh
9 Don't Cry Daddy 1969 the end is near

Pretty basic stuff—three fields, plus the ID, or key

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.