The pattern need not be a literal string. If either expr or pat is NULL, the result is NULL. Syntax: expr LIKE pat ESCAPE 'escapechar' Pattern matching using SQL simple regular expression comparison. So we have queried with 5 _'s to fetch the last name column with 6 character names ending with ' y' and so on it has done the job of fetching words ending with 'y' with 5 character origin. MySQL LIKE operator checks whether a specific character string matches a specified pattern. select * from customers where last_name like '_y' Same we wanted numbers ending with 9 and so it has fetched with the wildcard % in the beginning to get any number ending with 9. It has the following syntax: SELECT column1. The MySQL LIKE condition allows wildcards to be used in the WHERE clause of a SELECT, INSERT, UPDATE, or DELETE statement. ![]() select * from customers where phone like '%9' The SQL LIKE operator is used with the WHERE clause to get a result set that matches the given string pattern. So as we can see clearly I have used the wildcards % to find anything that contains trail and avenue in the address column and it has fetched according to our query too.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |