In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "how to get better search results in MySQL". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to get better search results in MySQL".
1. Set up the basic form
To start by creating an example table, use the following SQL command
The following is the referenced content:
Mysql > CREATETABLEreviews (idINT (5)
PRIMARYKEYNOTNULLAUTO_INCREMENT,dataTEXT)
The above command creates a simple database of music albums (mainly entire paragraphs of text), and then adds some records to the table:
The following is the referenced content:
Mysql > INSERTINTO`roomws` (`id`, `data`) VALUES
(1) GingerboyhasanewsingleoutcalledThrowingRocks.
It\ 'skeeper'); mysql > INSERTINTO`roomws` (`id`, `data`)
VALUES (2) Helloall1.
Oneofthehottesttrackscurrentlyplaying...
I\ 'vebeenlisteningtoitallday'); mysql > INSERTINTO`roomws`
(`id`, `data`) VALUES (3 recorder HaveyouheardthenewbandHotter
ThanHellTheyhavefivemembersandtheyburntheir
Instrumentswhentheyplayinconcerts.
Theseguystotallyrocklike Like, awesome, and dudewings')
Verify the correct entry of data:
The following is the referenced content:
Mysql > SELECT*FROMreviews
+-+-
| | id | data |
+-+-
| | 1 | Gingerboyhasanewsingleoutcalled... |
| | 2 | Helloall,IreallylikethenewMadon... |
| | 3 | HaveyouheardthenewbandHotterThan... |
3rowsinset (0.00sec)
2. Define full-text search fields
Next, define the fields you want to use as a full-text search index
The following is the referenced content:
Mysql > ALTERTABLEreviewsADDFULLTEXTINDEX (data)
QueryOK,3rowsaffected (0.21sec)
Records:3Duplicates:0Warnings:0
Use the SHOWINDEXES command to check that the index has been added:
The following is the referenced content:
Mysql > SHOWINDEXESFROMreviews
+-+ +
| | Table | Column_name | Packed | Null | Index_type | Comment | |
-+
| | reviews | id | NULL | | BTREE |
Reviews | data | NULL | YES | FULLTEXT | |
+-+ +
The above is all the contents of the article "how to get better search results in MySQL". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.