Quotation Marks in Conditions
When you compare a column expression with a constant expression in any
comparison condition, observe the following rules:
- If the column has a numeric data type, do not enclose the constant expression between quotation marks.
- If the column has a character data type, enclose the constant expression between quotation marks.
- If the column has a time data type, enclose the constant expression between quotation marks.
Otherwise, you might get unexpected results.
The following example shows the correct use of quotation marks in comparison
conditions. Here the ship_instruct column has a character
data type, the order_date column has a date data type,
and the ship_weight column has a numeric data type.
SELECT * FROM orders WHERE ship_instruct = 'express' AND order_date > '05/01/98' AND ship_weight < 30;