- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How LIKE operator works with comparison operators for matching specific kinds of patterns of a string?
We can also use comparison operators in WHERE clause along with LIKE operator to get specific output. It is demonstrated in the following example −
Example
Suppose we want to get the names end with letter ‘v’ from a table but we do not want a specific name say ‘Gaurav’ in the result set then we need to use comparison operator along with LIKE operator 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)
Advertisements