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

前端 未结 13 916
悲哀的现实
悲哀的现实 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:31

    create table A (id int,name varchar(30))
    
    insert into A values(4,'subhash')
    

    Use the trailing whitespace to search the name field:

    select * from A where name='Subhash '
    --Yields 1 row
    select * from A where name like 'Subhash '
    --Yields 0 row
    

提交回复
热议问题