Difference between SQL LIKE without percent signs and equal (=) in WHERE clause

前端 未结 2 592
萌比男神i
萌比男神i 2021-01-13 06:53

Are there any differences in the results of these two queries other than performance?

SELECT * FROM pet WHERE name LIKE \'Spot\';
SELECT * FROM pet WHERE nam         


        
2条回答
  •  情书的邮戳
    2021-01-13 07:36

    Effectively, it turns out to be the same thing in your example, but here is more info:

    From another stackoverflow answer

    = is a comparison operator that operates on numbers and strings. When comparing strings, the comparison operator compares whole strings.

    LIKE is a string operator that compares character by character.

提交回复
热议问题