Like

SQL LIKE

The LIKE keyword is used to return rows if the operand matches a pattern.

Syntax

SELECT * FROM name_of_table WHERE name_of_column LIKE pattern;

Example

Table of books

ID NAME PRICE
1 Learn Python 45
2 MySQL Tutorial 32
3 PHP examples 24
4 Learn SQL 32
SELECT * FROM books WHERE name LIKE '%Learn%';

Output

ID NAME PRICE
1 Learn Python 45
4 Learn SQL 32
SELECT * FROM books WHERE name LIKE 'MySQL%';

Output

ID NAME PRICE
2 MySQL Tutorial 32