Like Operator in SQL

The LIKE operator is used in a WHERE clause to retrieve all records of a table whose specified column values match a specified pattern. The percent sign (%) and underscore (_) are two wildcards used in the LIKE operator pattern. The underscore represents a single character and percent sign represents the multiple characters.

Syntax:

SELECT * FROM tableName WHERE columnName LIKE pattern;

Example:

SELECT * FROM EMPLOYEE WHERE EMP_NAME LIKE 'P%';

Output:

EMP_ID	EMP_NAME	AGE	SALARY
1	Parbhjot	28	35000
5	Parmender	28	45000
4	Parbhjot	29	46000
2	Parmender	28	45000