1. like 也就是模糊查询 如:select * from user where user_name '%李%'
  2. locate 判断是否包含某字符串 如:select * from user where locate('李',user_name)>0
  3. position 判断是否包含某字符串 如:select * from user where position('李' in user_name)>0
  4. instr 判断是否包含某字符串 如:select * from user where instr(user_name,'李')>0
  5. find_in_set 正好反过来,库里字段的值是否被包含在条件字符串里 如下:
select * from user where find_in_set (user_name,'李刚,刘备')>0
  1. 正则匹配两个字符串是否含有交集,我中有你,你中有我,如有共同部分,则返回数据,如下:
select * from user where user_name REGEXP REPLACE('李刚,刘备',',','|')
  1. CONCAT(',',str,',') 查询某字段中以逗号分隔的字符串的方法,好处是如果是数字逗号拼接的话,查询的参数是个位数的话,很容易查询出一大堆覆盖个位数的多位数数字
select * from user where CONCAT(',','李刚,刘备',',') like '%,刘备,%'