Difference between LIKE and = in MYSQL?

后端 未结 12 1914

What\'s the difference between

SELECT foo FROM bar WHERE foobar=\'$foo\'

AND

SELECT foo FROM bar WHERE foobar LIKE\'$foo\'         


        
12条回答
  •  借酒劲吻你
    2020-11-29 08:53

    According to the MYSQL Reference page, trailing spaces are significant in LIKE but not =, and you can use wildcards, % for any characters, and _ for exactly one character.

提交回复
热议问题