Subscribe:

Thursday, September 29, 2011

LIKE

When you don’t know what value you need to search then you can use the like operator in where cluse.
Symbols with like.
(%) represents any number of characters
(_) the underscore symbol represents a single character.
The search string is enclosed in single quotation marks.sql wildcard
Examples
Select ename,job
From emp
Where ename like ‘c%’;
Ename      job
---------- ---------
Clark      manager


Select ename,job
From emp
Where ename like ‘s%’;
Ename      job
---------- ---------
Smith      clerk
Scott      analyst
Sql> select ename
  2  from emp
  3  where ename like '_a%';

Ename
----------
Ward
Martin
James
The result is a list of employee names .each name includes the letter a as the second letter in the name.

No comments:

Post a Comment