LIKE Operator:
It is used to search for pattern in a table or a database . It is used with where condition. It is similar to REGEXP of MySQL.
Syntax:
SELECT columnname(s) FROM tablename WHERE columnname LIKE pattern-condition;
Example1:
SELECT Name FROM Employee WHERE Address LIKE 'r%';
The above query will select those Employee names whose address start with letter "r" like rishikesh etc.
Example2:
SELECT Name FROM Employee WHERE Address LIKE '%a';
The above query will select those Employee names whose address ends with letter "a" like noida,america etc.
Example3:
SELECT Name FROM Employee WHERE Address LIKE '%arid%';
The above query will select those Employee names whose address contains substring "arid" like haridwar etc.
0 Comment(s)