Top Menu

Search This Blog

SQL LIKE Operator

The LIKE operator is used in a WHERE clause to search for a specified pattern record in a column.
The "%" sign is used to define missing letters both before and after the string.

Syntax:


SELECT *
FROM table_name
WHERE column_some_name LIKE pattern

As you see, we have like this "Candidate" table.














Example:
The following SQL syntax selects all candidate with a PostCode containing the pattern "64"

select * from CANDIDATE where PostCode like '%64%'

Output:









The following SQL syntax selects all candidate with a FirstName starting with the letter "v%"
 select * from CANDIDATE where FirstName like 'v%'

Output:







The following SQL syntax selects all candidate with a FirstName ending with the letter "%al"
 select * from CANDIDATE where FirstName like '%al'

Output:


Post a Comment

Designed by OddThemes | Distributed By Gooyaabi Templates