SQL搜索包含术语 [英] SQL search for containing terms

查看:72
本文介绍了SQL搜索包含术语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在表中搜索其名称包含搜索项的记录?

If it possible to search in a table for records of which its name contains a search term?

谢谢

推荐答案

SELECT * FROM `my_table` WHERE name LIKE '%my_search_term%'

SELECT * FROM `my_table` WHERE CONTAINS(name, 'search')

但是请注意,LIKE语句非常昂贵。如果您搜索大量文本,则可能需要考虑使用Sphinx作为示例。

But be aware that the LIKE statement is very expensive. If you searching through a lot of text, you might want to consider using Sphinx for exemple.

这篇关于SQL搜索包含术语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆