全文索引——contains语法
1、查询住址在北京的学生
select student_id,student_name from student
where contains(address,'beijing')
remark:beijing是一个单词,要用单引号括起来。
2、查询住址在河北省的学生
select student_id,student_name from student
where contains(address,'"hebei province"')
remark:hebei province是一个词组,在单引号里要用双引号括起来。
3、查询住址在河北省或北京的学生
select student_id,student_name from student
where contains(address,'"hebei province" or beijing')
remark:可以指定逻辑操作符(包括AND,AND NOT,OR)
4、查询有“南京路”字样的地址
select student_id,student_name from student
where contains(address,'nanjing NEAR road')
remark:上面的查询将会返回包括‘nanjing road’,‘nanjing east road’等字样的地址。
A NEAR B,就是表示条件:A靠近B。
5、查询以‘湖’开头的地址
select student_id,student_name from student
where contains(address,'"湖*"')
1、查询住址在北京的学生
select student_id,student_name from student
where contains(address,'beijing')
remark:beijing是一个单词,要用单引号括起来。
2、查询住址在河北省的学生
select student_id,student_name from student
where contains(address,'"hebei province"')
remark:hebei province是一个词组,在单引号里要用双引号括起来。
3、查询住址在河北省或北京的学生
select student_id,student_name from student
where contains(address,'"hebei province" or beijing')
remark:可以指定逻辑操作符(包括AND,AND NOT,OR)
4、查询有“南京路”字样的地址
select student_id,student_name from student
where contains(address,'nanjing NEAR road')
remark:上面的查询将会返回包括‘nanjing road’,‘nanjing east road’等字样的地址。
A NEAR B,就是表示条件:A靠近B。
5、查询以‘湖’开头的地址
select student_id,student_name from student
where contains(address,'"湖*"')