The best SQL LIKE operator Tutorial In 2024, In this tutorial you can learn SQL LIKE operator,The demo database,SQL LIKE operator examples,Examples,Examples,Examples,Examples,
LIKE operator is used in the WHERE clause to search columns specified pattern.
LIKE operator is used in the WHERE clause to search columns specified pattern.
In this tutorial, we will use w3big sample database.
The following is a selected "Websites" table data:
+----+--------------+---------------------------+-------+---------+ | id | name | url | alexa | country | +----+--------------+---------------------------+-------+---------+ | 1 | Google | https://www.google.cm/ | 1 | USA | | 2 | 淘宝 | https://www.taobao.com/ | 13 | CN | | 3 | 本教程 | http://www.w3write.com/ | 4689 | CN | | 4 | 微博 | http://weibo.com/ | 20 | CN | | 5 | Facebook | https://www.facebook.com/ | 3 | USA | | 7 | stackoverflow | http://stackoverflow.com/ | 0 | IND | +----+---------------+---------------------------+-------+---------+
The following SQL statement to select all the customer name with the letter "G" begins:
Execution output:
Tip: "%" symbol is used to define the pattern before and after the wildcard (default alphabet). You will learn more about wildcards in the next chapter.
The following SQL statement to select all the customer name with the letter "k" at the end of:
Execution output:
The following SQL statement selects all the customer name contains the pattern "oo" of:
Execution output:
By using the NOT keyword, you can select the record does not match the pattern.
The following SQL statement does not contain the name chosen mode "oo" of all customers:
Execution output: