Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the uses of the Contains function in Oracle

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

What are the uses of the Contains function in Oracle? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

1. Inquire about the students whose addresses are in Beijing

SELECT student_id,student_nameFROM studentsWHERE CONTAINS (address, 'beijing')

Remark: beijing is a word that is enclosed in single quotation marks.

two。 Inquire about the students whose addresses are in Hebei Province.

SELECT student_id,student_nameFROM studentsWHERE CONTAINS (address,'"HEIBEI province"')

Remark: HEBEI province is a phrase that is enclosed in double quotes in single quotes.

3. Inquire about the students whose address is in Hebei or Beijing.

SELECT student_id,student_nameFROM studentsWHERE CONTAINS (address,'"HEIBEI province" OR beijing')

Remark: you can specify logical operators (including AND, AND NOT,OR).

4. Query the address with the words' Nanjing Road'.

SELECT student_id,student_nameFROM studentsWHERE CONTAINS (address, 'nanjing NEAR road')

Remark: the above query will return an address that contains the words' nanjing road','nanjing east road','nanjing west road', etc.

A NEAR B means condition: an is close to B.

5. Query addresses that start with 'lake'

SELECT student_id,student_nameFROM studentsWHERE CONTAINS (address,'"hu*"')

Remark: the above query will return an address that contains the words' hubei','hunan', etc.

Remember it's *, not%.

6. Similar weighted query

SELECT student_id,student_nameFROM studentsWHERE CONTAINS (address, 'ISABOUT (city weight (.8), county wright (.4)')

Remark: ISABOUT is the keyword for this query, and weight specifies a number between 0 and 1, a similar coefficient (as I understand it). It means that different conditions have different emphasis.

7. Polymorphic query of words

SELECT student_id,student_nameFROM studentsWHERE CONTAINS (address, 'FORMSOF (INFLECTIONAL,street)')

Remark: the query will return an address that contains the words' street','streets', etc.

The verb will return its different tenses, such as dry, dry,dried,drying, and so on.

8. Word query example

A word query is a query for exact words or phrases entered between single quotation marks in the CONTAINS operator. In the following example, we will find all documents that contain the word oracle in the text column. The score for each row is selected by using the SCORE operator of label 1:

SELECT SCORE (1) title from news WHERE CONTAINS (text,'oracle',1) > 0

In query expressions, you can use text operators such as AND and OR to get different results. You can also add structural predicates to the WHERE clause. You can use count (*), CTX_QUERY.COUNT_HITS, or CTX_QUERY.EXPLAIN to calculate the number of hits (matches) for a query.

9 example of ABOUT query

In all languages, ABOUT queries increase the number of related documents returned by a query. In English, ABOUT queries can use the subject word component of an index, which is created by default. In this way, the operator returns the document based on the concept of the query, not just on the exact word or phrase specified. For example, the following query finds all documents on the topic politics in the text column, not those that contain only the word politics:

SELECT SCORE (1) title from news WHERE CONTAINS (text, 'about (politics)', 1) > 0

Have you learned it? Just do it and try it yourself.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report