In Oracle, the "not like" operator is used to search for specified content that does not include columns in the WHERE clause, which can achieve the effect of fuzzy query. The syntax is "SELECT field FROM table name WHERE field NOT LIKE wildcard".
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
LIKE operator
The LIKE operator is used to search for the specified pattern in the column in the WHERE clause.
SQL LIKE operator syntax
SELECT column_name(s) FROM table_name WHERE column_name LIKE pattern
By using the NOT keyword, you can search for content that does not contain the specified content in the column
There are two wildcards: % percent sign represents any number Character, _underscore represents a character.
1. like'Mc%' will search for all strings starting with the letters Mc.
2. like'%inger' will search for all strings ending with the letters inger.
3. like'%en%' will search for all strings containing the letter en at any position.
The example is as follows:
Original table
By using the NOT keyword, we can select from the "Persons" table People who live in cities that do not contain "lon":
We can use the following SELECT statement:
SELECT * FROM Persons WHERE City NOT LIKE '%lon%'
The results are as follows:
Recommended tutorial: "Oracle Video Tutorial"
The above is the detailed content of What is the usage of not like in oracle. For more information, please follow other related articles on the PHP Chinese website!