What's the difference between “LIKE” and “=” in SQL?

前端 未结 13 893
悲哀的现实
悲哀的现实 2020-12-05 12:56

Is there any difference between:

SELECT * FROM users WHERE username=\"davyjones\"

and

SELECT * FROM users WHERE username LI         


        
13条回答
  •  情深已故
    2020-12-05 13:44

    LIKE allows partial matching / use of wildcards, while = checks for exact matches.

    For example

    SELECT * FROM test WHERE field LIKE '%oom';
    

    Will return rows where field value is any of the following:

    Zoom, Boom, Loom, Groom
    

提交回复
热议问题