Full-text index-CONTAINS syntax
We usually use CONTAINS in the Where clause, like this: Select * FROM table_name Where CONTAINS (fullText_column, 'search CONTENTS ').
Let's take an example to learn about it. Suppose there is a table students, where the address is a full text retrieval column.
1. query student addresses in Beijing
Select student_id, student_name
FROM students
Where CONTAINS (address, 'beijing ')
Remark: beijing is a word that must be enclosed in single quotes.
2. query student addresses in Hebei Province
Select student_id, student_name
FROM students
Where CONTAINS (address, '"HEIBEI province "')
Remark: HEBEI province is a phrase that must be enclosed in double quotation marks.
3. query student addresses in Hebei province or Beijing
Select student_id, student_name
FROM students
Where CONTAINS (address, '"HEIBEI province" or beijing ')
Remark: You can specify logical operators (including AND, and not, OR ).
4. query the addresses with the words "Nanjing Road"
Select student_id, student_name
FROM students
Where CONTAINS (address, 'nanjing NEAR road ')
Remark: The above query will return addresses that contain the words "nanjing road", "nanjing east road", and "nanjing west road.
A near B indicates that A is near B.
5. query the address starting with 'hu '.
Select student_id, student_name
FROM students
Where CONTAINS (address, '"hu *"')
Remark: The preceding query returns an address containing the words 'hubei' and 'hunanc.
Remember: *, not %.
6. Weighted queries
Select student_id, student_name
FROM students
Where CONTAINS (address, 'isabout (city weight (. 8), county wright (. 4 ))')
Remark: ISABOUT is the keyword of this query. weight specifies a value ranging from 0 ~ The number between 1, similar to the coefficient (I understand ). Indicates that different conditions have different focuses.
7. multi-state query of words
Select student_id, student_name
FROM students
Where CONTAINS (address, 'formsof (INFLECTIONAL, street )')
Remark: The query returns the addresses that contain the words 'street 'and 'streets.
For a verb, different tenses are returned, such as dry, dry, dried, drying, and so on.
All of the above examples use English, not Chinese because some query methods do not support Chinese, and my computer is an English system.
Full-text index-CONTAINS syntax
We usually use CONTAINS in the Where clause, like this: Select * FROM table_name Where CONTAINS (fullText_column, 'search CONTENTS ').
Let's take an example to learn about it. Suppose there is a table students, where the address is a full text retrieval column.
1. query student addresses in Beijing
Select student_id, student_name
FROM students
Where CONTAINS (address, 'beijing ')
Remark: beijing is a word that must be enclosed in single quotes.
2. query student addresses in Hebei Province
Select student_id, student_name
FROM students
Where CONTAINS (address, '"HEIBEI province "')
Remark: HEBEI province is a phrase that must be enclosed in double quotation marks.
3. query student addresses in Hebei province or Beijing
Select student_id, student_name
FROM students
Where CONTAINS (address, '"HEIBEI province" or beijing ')
Remark: You can specify logical operators (including AND, and not, OR ).
4. query the addresses with the words "Nanjing Road"
Select student_id, student_name
FROM students
Where CONTAINS (address, 'nanjing NEAR road ')
Remark: The above query will return addresses that contain the words "nanjing road", "nanjing east road", and "nanjing west road.
A near B indicates that A is near B.
5. query the address starting with 'hu '.
Select student_id, student_name
FROM students
Where CONTAINS (address, '"hu *"')
Remark: The preceding query returns an address containing the words 'hubei' and 'hunanc.
Remember: *, not %.
6. Weighted queries
Select student_id, student_name
FROM students
Where CONTAINS (address, 'isabout (city weight (. 8), county wright (. 4 ))')
Remark: ISABOUT is the keyword of this query. weight specifies a value ranging from 0 ~ The number between 1, similar to the coefficient (I understand ). Indicates that different conditions have different focuses.
7. multi-state query of words
Select student_id, student_name
FROM students
Where CONTAINS (address, 'formsof (INFLECTIONAL, street )')
Remark: The query returns the addresses that contain the words 'street 'and 'streets.
For a verb, different tenses are returned, such as dry, dry, dried, drying, and so on.
All of the above examples use English, not Chinese because some query methods do not support Chinese, and my computer is an English system.
Source: http://www.nbman.cn/default.asp? Id = 97