We can also use comparison operators as well as LIKE operator in WHERE clause to get specific output. The following example demonstrates -
Suppose we want to get the names ending with letter 'v' from the table but we don't want the specific name 'Gaurav' in the result set , we need to use comparison operators and LIKE operators, as follows-
mysql> Select * from student where name like '%v'and name != 'gaurav'; +------+-------+---------+---------+--------------------+ | Id | Name | Address | Subject | year_of_admission | +------+-------+---------+---------+--------------------+ | 2 | Aarav | Mumbai | History | 2010 | +------+-------+---------+---------+--------------------+ 1 row in set (0.00 sec)
The above is the detailed content of How can the LIKE operator be used with comparison operators to match a specific type of pattern on a string?. For more information, please follow other related articles on the PHP Chinese website!