When using SQL, are there any benefits of using =
in a WHERE
clause instead of LIKE
?
Without any special operators, LIKE
For this example we take it for granted that varcharcol doesn't contain ''
and have no empty cell against this column
select * from some_table where varcharCol = ''
select * from some_table where varcharCol like ''
The first one results in 0 row output while the second one shows the whole list. = is strictly-match case while like acts like a filter. if filter has no criteria, every data is valid.
like - by the virtue of its purpose works a little slower and is intended for use with varchar and similar data.