The statements in the following query illustrate the use
of a single-character wildcard in a WHERE clause. Further, they demonstrate
a query on a table that is not in the current database. The stock table
is in the database sloth. Besides being outside the current
demonstration database, sloth is on a separate database server
called meerkat.
SELECT stock_num, manu_code, description, unit_price
FROM sloth@meerkat:stock
WHERE manu_code LIKE '_R_'
AND unit_price >= 100
ORDER BY description, unit_price;
SELECT stock_num, manu_code, description, unit_price
FROM sloth@meerkat:stock
WHERE manu_code MATCHES '?R?'
AND unit_price >= 100
ORDER BY description, unit_price;
Each statement in the query retrieves only those rows
for which the middle letter of the manu_code is R,
as the result shows. The comparison '_R_' (for LIKE)
or '?R?' (for MATCHES) specifies, from left to right,
the following items: