Usage of like in sql:
The operator LIKE uses wildcards to compare a value with similar values. There are two wildcards:
1. Percent sign (%): represents zero, one or more characters
2. Underscore (_): represents a number or character
The condition matches any value that starts with 200
WHERE SALARY LIKE '200%'
The following condition matches any value that contains 200 (at any position)
WHERE SALARY LIKE '%200%'
The following condition matches the second and third characters that are 0 Value
WHERE SALARY LIKE '_00%'
The following condition matches values that start with 2 and have a length of at least 3
WHERE SALARY LIKE '2_%_%'
The following condition matches values whose second position is 2 and ends with 3
WHERE SALARY LIKE '_2%3'
Recommended tutorial: "sql tutorial"
The above is the detailed content of How to use like in sql. For more information, please follow other related articles on the PHP Chinese website!