Home  >  Article  >  Database  >  What is the usage of not like in oracle

What is the usage of not like in oracle

WBOY
WBOYOriginal
2022-03-03 10:26:0913531browse

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".

What is the usage of not like in oracle

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

What is the usage of not like in oracle

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

What is the usage of not like in oracle

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:

What is the usage of not like in oracle

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn