• September 30, 2014
  • SQL
  • Comments Off on SQL LIKE operator

SQL LIKE operator

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

 
Next Topic: SQL ORDER BY Clause with example.
Previous Topic: SQL UNION Operator with example.

Related Topics:

How to build java project using ant in eclipse?
JAXB marshalling – convert java object to xml example.
How to create pdf file in java using iText jar?
Generics class example.
OGNL in struts 2.
Hibernate One-to-One Mapping using xml.
Send inline image in email using JavaMail API.
Quartz 2 JobListener example.

 


Comments are closed.