As Requested: Good SQL book and Examples of SQL's LIKE statement

Hello All,

I lost the fellow's E-Mail address that asked for this, but I thought a
few more of you might also want to see it... So:

The syntax for standard SQL (this is what you should use when going
through ODBC... In other words, this is what you should use in Delphi) for
the LIKE statement in a WHERE clause:

Suppose your data is:

Andrew
Ronald
Jeff
Allen

Then the following select statements will act as described.

SELECT * FROM TableName WHERE ColumnName LIKE 'Allen'  

- That is acts just like an ColumnName = 'Allen', so the only data you
would get back is Allen.

SELECT * FROM TableName WHERE ColumnName LIKE 'A%'  

- That is like DOS's * wild card with a DIR command. So, it will pull all
matches that start with 'A'. You would get Allen and Andrew back with this
one.

SELECT * FROM TableName WHERE ColumnName LIKE '%n%'  

- That will pull all matches that have 'n' in them. So, you would get
Andrew, Ronald, and Allen.

SELECT * FROM TableName WHERE ColumnName LIKE '%f'  

- That will pull all matches that end with 'f'. So, you would only get
back Jeff.

Now, if you want to match a single letter, you use the underscore (though
I seem to remember the question mark also being used...).

So, if you did the following:

SELECT * FROM TableName WHERE ColumnName LIKE '_llen'  

- That will give you Allen. As will:

SELECT * FROM TableName WHERE ColumnName LIKE 'A___n'  

And on and on. The Lan Times Press puts out a good book on standard SQL.
It is called: Guide To SQL (Covers SQL2) from the Lan Times. The ISBN
number is: ISBN 0-07-882026-X. It is around $30 US. The authors are James
R. Groff and Paul N. Weinberg.

It gives a very nice and detailed over-view if general SQL with examples,
some product comparisons (like, every database uses a slightly different
syntax to create tables!), and the history of SQL.

I hope this helps anyone who is interested.

Later folks!
Allen