Joshua Beall wrote:
- er, there is no difference as you've written it. But if you use wildcards, you get a very different set of results:Hi All,
From what I understand the LIKE keyword allows you to do things like includewildcards and match against regular expressions.
But I have a question: is there any difference between the following?
SELECT lname, fname FROM contacts WHERE lname = 'smith'; SELECT lname, fname FROM contacts WHERE lname LIKE 'smith';
I'm having difficulty figuring out the difference between these two queries, if there is any. Can someone clarify?
SELECT lname, fname FROM contacts WHERE lname = 'smith';
... will bring back all rows where lname is exactly 'smith'
SELECT lname, fname FROM contacts WHERE lname LIKE '%smith%';
... will bring back all rows where lname contains the letters 's m i t h', in that order, such as Smithfield, Aerosmith, Nasmith, Smithsonian...
- ian
-- +-------------------------------------------------------------------+ | Ian Sales Database Administrator | | | | "If your DBA is busy all the time... | | ...he's not doing his job properly" | | eBuyer http://www.ebuyer.com | +-------------------------------------------------------------------+
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]