LIKE

To select character data when you only know part of a value, use LIKE in a WHERE clause, plus a symbol for the unknown data:

You can also use % and _ together. For example, to select every name with AN or ON as the second and third letters:

SELECT ID, NAME
FROM Q.STAFF
WHERE NAME LIKE '_AN%' OR NAME LIKE '_ON%'

LIKE can be used only with character and graphic data. For character data, the value after LIKE must always be enclosed in single quotation marks. If you are using graphic data, the value after LIKE must be preceded by the single-byte character 'G' enclosed in single quotation marks. The percent sign and the underscore must be double-byte characters.

[ Previous Page | Next Page | Contents | Index ]