|
- The column name following the
WHERE clause must contain
character values; otherwise, the LIKE operator cannot be used. - The
LIKE operator compares the value in the specified column
with the pattern, as inserted in single quotes following LIKE. A row
is retrieved if a match occurs. - You can put any Metamorph query in quotes (
'query') in
place of a fixed length string, although you would need to escape a
literal ' with another ' by typing '', if you
want the character ' to be part of the query. - The "pattern" inside single quotes following
LIKE will be
interpreted exactly as Metamorph would interpret such a query on its
query line, in any Metamorph application (with the only exception
being that a single quote or apostrophe must be escaped with
another ' to be interpreted literally). - Concept searching is off by default for Metamorph queries
following
LIKE, but can be selectively invoked on a word using the
tilde `~'. - Syntax for complete use of Metamorph query language is covered
in Chapter here.
- Queries using
LIKE can make use of any indexing which has been
done. An alternate form of LIKE may also be used called LIKE3, which
uses indexing exclusively with no post search. See
Chapter here for a thorough explanation of all types of
text searches possible with LIKE and LIKE3, and their relation to
indexed information.
Example:
Let's start with a simple example. You wish to retrieve all reports
where "ink" is part of the title, without knowing the full title.
If you enter the statement:
SELECT TITLE
FROM REPORT
WHERE TITLE LIKE 'ink' ;
the result displayed will be:
TITLE
Innovations in Disappearing Ink
Disappearing Ink Promotional Campaign
Ink Color Panorama
|
In this query, you are retrieving the titles of all reports whose
title is "like" the pattern "ink".
In other cases you may not know the exact words you are looking for.
A simple example where a wildcard '*' is used follows.
SELECT AUTHOR, DEPT
FROM REPORT
WHERE AUTHOR LIKE 'san*' ;
The result will be:
AUTHOR DEPT
Sanchez, Carla MKT
Sanders, George G. FIN
Claus, Santa MKT
|
Copyright © Thunderstone Software Last updated: Sun Mar 17 21:14:49 EDT 2013
|