好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

Mysql全文本检索

mysql 全文索引 注意 并非所有的引擎都支持 全文检索 mysql最常用的引擎 INnodb 和 myisam 后者支持全文检索 前者不支持 创建表的时候指定要检索列 CREATE TABLE TEST_FULLTEXT(note_id int not null auto_increment,note_text text null ,primaty key (note_

mysql 全文索引

注意 并非所有的引擎都支持 全文检索

mysql最常用的引擎 INnodb 和 myisam 后者支持全文检索 前者不支持

创建表的时候指定要检索列

   CREATE   TABLE  TEST_FULLTEXT(note_id  int   not   null  auto_increment,note_text text  null ,
primaty  key (note_id),FULLTEXT(note_text)
)engine=myisam; 
  

fulltext 索引某个列 fulltext(note_text) ,在某note_text列上建立全文索引

插入数据

然后用 match()指定列 Against()指定词
如 语句

   select  *
 from  TEST_FULLTEXT
 where   Match (note_text) Against( 'hello' ); 
  

查找note_txt列中含有 hello词的行 返回的 结果为 两行

 note_text
'hello' was said by quester 
quster say 'hello' to pp and he try again
  

查看更多关于Mysql全文本检索的详细内容...

  阅读:43次