User Guide

Chapter 3: Querying a Database 23
Operators
These specify conditions and perform logical and numeric functions:
SQL Notes and Considerations
Keep the following in mind when writing SQL in ColdFusion:
There is a lot more to SQL than what is covered here. It’s a good idea to
purchase one or several SQL guides that you can refer to.
The data source, columns, and tables that you reference must exist in order to
perform a successful query.
Some DBMS vendors use non-standard SQL syntax (known as a dialect) in their
products. ColdFusion does not validate the SQL in a CFQUERY, so you are free
to use any syntax that is supported by your data source. Check your DBMS
documentation for non-standard SQL usage.
Basic SQL Operators
Operator Description
AND Both conditions must be met, such as Paris AND Texas
OR At least one condition must be met, such as Smith OR Smyth
NOT Exclude the condition following, such as Paris NOT France
=Equal to
<> Not equal to
<Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
+ Addition
-Subtraction
/ Division
*Multiplication