Difference between LIKE and = in MYSQL?

mysql

Solution

LIKE can do wildcard matching:

SELECT foo FROM bar WHERE foobar LIKE "Foo%"

If you don't need pattern matching, then use = instead of LIKE. It's faster and more secure. (You are using parameterized queries, right?)

Problem

What's the difference between ``` SELECT foo FROM bar WHERE foobar='$foo' ``` AND ``` SELECT foo FROM bar WHERE foobar LIKE'$foo' ```

Original source