LIKE operator is pattern matching In SQL. LIKE means Not Exactly just match some pattern for example when we use IN or BETWEEN or in Equal To (=) relational operator, then the Complete value compare if its match the whole value which is given in Condition then Its return other wise not. But in like operator we just provide a part of text and ask to match this part of text with whole text.
We use percentage % and underscore _ wildcards with like operator. Where % is substitutes for zero or more characters and _ are used as substitutes of any single character.
For example from table given below:
Actual Table
| client_name | city | order_amount |
| Syed Tauqeer | Karachi | 50000 |
| Muhammad Zia Ahmed | Lahore | 20000 |
| Noman Bloch | Karachi | 30000 |
| Imran Hadir | Islamabad | 10000 |
| Muneer Bloch | Karachi | 15000 |
| Muhammad Zia Khan | Islamabad | 30000 |
SELECT * FROM client_info WHERE client_name like '%Bloch'
This statement show that second part of name or last part of name is Bloch and before the Bloch we did not know
The above statement display the following record.
Selected record with BETWEEN Operator
| client_name | city | order_amount |
| Noman Bloch | Karachi | 30000 |
| Muneer Bloch | Karachi | 15000 |
Read more about the Use of percentage % and underscore _ wildcards with LIKE operator
Select Command
Distinct clause with Select Command
Where clause In SQL
Logical Operator in SQL SELECT Statement
IN Operator in SQL
BETWEEN Operator in SQL
Use of Wildcards in SQL
LIKE Operator in SQL
ORDER BY Clause in SQL
GROUP BY Clause in SQL
HAVING Clause in SQL
ALIAS In SQL
AS Keyword In SQL
INSERT INTO Command In SQL
Inserting Record In to a Table Form an other Table In SQL
UPDATE Command in SQL
DELETE Command in SQL
AVG Function in SQL