SQL LIKE Operator

SHOW Table:

select * from employeeinfo;

name age address salary
Komal 25 Mumbai 25000
Ramesh 35 Delhi 25000
Kaushik 31 Indore 25000
Hardik 22 Hyderabad 25000
Glory 28 Kanpur 25000
Akshaya 29 Delhi 25000

LIKE Operator:

select * from employeeinfo where name LIKE ‘K%’;

name age address salary
Komal 25 Mumbai 25000
Kaushik 31 Indore 25000

select * from employeeinfo where name LIKE ‘%l’;

name age address salary
Komal 25 Mumbai 25000

select * from employeeinfo where name LIKE ‘%me%’;

name age address salary
Ramesh 35 Delhi 25000

select * from employeeinfo where name NOT LIKE ‘%me%’;

name age address salary
Komal 25 Mumbai 25000
Kaushik 31 Indore 25000
Hardik 22 Hyderabad 25000
Glory 28 Kanpur 25000
Akshaya 29 Delhi 25000

Leave a Reply

Your email address will not be published. Required fields are marked *