Filtering data through WHERE

What is the difference between filtering data through

WHERE medium = ‘gold’

and when using

WHERE medium LIKE ‘%gold’

As you might expect, = is for exact matches. This will return only results where the value for medium matches ‘gold’ exactly.

LIKE is for similar matches. This will return any result where the value for medium is a string ending in ‘gold’. For example, mediums of ‘fools gold’ or ‘white gold’ would be included as well as simply ‘gold.’ The % acts as a wildcard for 0 or more characters.

2 Likes