mysql数据量sql 查询语句特殊字符转义

  • A+
所属分类:LNMP

特殊符号不转义,你会发现sql语句增删查弄了个寂寞,什么都无效!

1
2
3
4
5
6
7
8
9
10
11
12
1,搜索a'b...

SELECT * FROM user WHERE name LIKE 'a\'b%';
2,搜索a%b...

SELECT * FROM user WHERE name LIKE 'a\%b%';
3,搜索a_b...  

SELECT * FROM user WHERE name LIKE 'a\_b%';
4,搜索a\b...

SELECT * FROM user WHERE name LIKE  'a\\\\b%';

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: