Qualifying a SELECT Statement with Conditions

By adding one or more conditions to my WHERE clause, I can get very specific as to which records I want my query to retrieve. Each condition functions like a true-false statement: If the query examines a record in which the conditional statement is true, the record is returned as output. If the statement is false, the query ignores the record and moves on.

SQL uses two types of operators to build conditional statements, relational operators and logical operators.

Relational Operators

Thus far, all my queries have used the equals operator (=), which determines whether the contents of a field are equal to the text I supply. The equal sign works just fine for comparing text strings such as "Baby, Let's ...

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.