This article mainly introduces the usage of the Contains function in Oracle. To query students whose address is in a certain city, the sql statement is introduced to you in great detail. Friends who need it can refer to it. I hope it can help everyone.
1. Query students whose address is in Beijing
SELECT student_id,student_name FROM students WHERE CONTAINS( address, 'beijing' )
#remark: beijing is a word, use single quotes bracketed.
2. Query students whose address is in Hebei Province
SELECT student_id,student_nameFROM students WHERE CONTAINS( address, '"HEIBEI province"' )
#remark: HEBEI province is a phrase, in a single word Also use double quotes within quotation marks.
3. Query students whose addresses are in Hebei Province or Beijing
SELECT student_id,student_nameFROM students WHERE CONTAINS( address, '"HEIBEI province" OR beijing' )
remark: Logical operators can be specified ( Including AND, AND NOT, OR).
4. Query the address with the words 'Nanjing Road'
SELECT student_id,student_name FROM students WHERE CONTAINS( address, 'nanjing NEAR road' )
remark: The above query will return the address containing Addresses with the words 'nanjing road', 'nanjing east road', 'nanjing west road', etc.
A NEAR B means the condition: A is close to B.
5. Query for addresses starting with 'lake'
SELECT student_id,student_name FROM students WHERE CONTAINS( address, '"hu*"' )
#remark: The above query will return addresses containing ' hubei', 'hunan', etc. addresses.
Remember it’s *, not %.
6. Similar weighted queries
SELECT student_id,student_name FROM students WHERE CONTAINS( address, 'ISABOUT (city weight (.8), county wright (.4))' )
remark: ISABOUT is the keyword for this kind of query, weight is specified A number between 0 and 1, similar to a coefficient (my understanding). Indicates that different conditions have different emphasis.
7. Polymorphic query for words
SELECT student_id,student_name FROM students WHERE CONTAINS( address, 'FORMSOF (INFLECTIONAL,street)' )
remark: The query will return items containing 'street', 'streets' ' and other words in the address.
For the verb will return to its different tense, such as: DRY, it will return to DRY, DRIED, DRYING and so on.
8. Word query example
A word query is a query for the exact word or phrase entered into the CONTAINS operator between single quotes. 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 the SCORE operator using tag 1:
SELECT SCORE(1) title from news WHERE CONTAINS(text,'oracle',1)> 0;
In query expressions, you can use textual operators such as AND and OR to obtain 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 count the number of hits (matches) for a query.
9 ABOUT Query Example
In all languages, the ABOUT query increases the number of related documents returned by a query. In English, ABOUT queries can use the subject heading component of the index, which is created by default. This way, the operator returns documents based on the concept of the query, rather than just the exact word or phrase you specified. For example, the following query will find all documents in the text column on the topic politics, rather than documents containing just the word politics:
SELECT SCORE(1) title from news WHERE CONTAINS(text, 'about(politics)', 1) > 0;
Did you learn it? Hurry up and try it yourself.
Related recommendations:
Full text index—CONTAINS syntax
JQuery contains selector_jquery
The above is the detailed content of Summary of usage of Contains function in Oracle. For more information, please follow other related articles on the PHP Chinese website!

MySQLhandlesconcurrencyusingamixofrow-levelandtable-levellocking,primarilythroughInnoDB'srow-levellocking.ComparedtootherRDBMS,MySQL'sapproachisefficientformanyusecasesbutmayfacechallengeswithdeadlocksandlacksadvancedfeatureslikePostgreSQL'sSerializa

MySQLhandlestransactionseffectivelyusingtheInnoDBengine,supportingACIDpropertiessimilartoPostgreSQLandOracle.1)MySQLusesREPEATABLEREADasthedefaultisolationlevel,whichcanbeadjustedtoREADCOMMITTEDforhigh-trafficscenarios.2)Itoptimizesperformancewithabu

MySQLisbetterforspeedandsimplicity,suitableforwebapplications;PostgreSQLexcelsincomplexdatascenarioswithrobustfeatures.MySQLisidealforquickprojectsandread-heavytasks,whilePostgreSQLispreferredforapplicationsrequiringstrictdataintegrityandadvancedSQLf

MySQL processes data replication through three modes: asynchronous, semi-synchronous and group replication. 1) Asynchronous replication performance is high but data may be lost. 2) Semi-synchronous replication improves data security but increases latency. 3) Group replication supports multi-master replication and failover, suitable for high availability requirements.

The EXPLAIN statement can be used to analyze and improve SQL query performance. 1. Execute the EXPLAIN statement to view the query plan. 2. Analyze the output results, pay attention to access type, index usage and JOIN order. 3. Create or adjust indexes based on the analysis results, optimize JOIN operations, and avoid full table scanning to improve query efficiency.

Using mysqldump for logical backup and MySQLEnterpriseBackup for hot backup are effective ways to back up MySQL databases. 1. Use mysqldump to back up the database: mysqldump-uroot-pmydatabase>mydatabase_backup.sql. 2. Use MySQLEnterpriseBackup for hot backup: mysqlbackup--user=root-password=password--backup-dir=/path/to/backupbackup. When recovering, use the corresponding life

The main reasons for slow MySQL query include missing or improper use of indexes, query complexity, excessive data volume and insufficient hardware resources. Optimization suggestions include: 1. Create appropriate indexes; 2. Optimize query statements; 3. Use table partitioning technology; 4. Appropriately upgrade hardware.

MySQL view is a virtual table based on SQL query results and does not store data. 1) Views simplify complex queries, 2) Enhance data security, and 3) Maintain data consistency. Views are stored queries in databases that can be used like tables, but data is generated dynamically.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
