SQL - Wildcard Operators

Ij
Posted by Ij under Oracle category on | Points: 40 | Views : 369
In SQL, wildcard characters are used with the SQL LIKE operator.
SQL wildcards are used to search for data within a table.

_(UNDER SCORE)...It matches single character
%(PERCENTAGE)...group of characters

LIKE Operater:-this operater is use to compare the data through pattern matching.

SQL>SELECT * FROM EMP WHERE ENAME LIKE 'J%';..display starting character
'jAMES'
SQL>SELECT * FROM EMP WHERE ENAME LIKE '%S';...display last letter of 'S'
'ADAMS'
'JAMES'

SQL>SELECT * FROM EMP WHERE ENAME LIKE '____';
ENAME
KING
FORD
WARD

SQL>SELECT * FROM EMP WHERE ENAME LIKE '__A%';
ENAME
BLAKE
CLARK
ADAMS


SQL>SELECT * FROM EMP WHERE SAL LIKE '%000';...It disply last three zeros of salary

Comments or Responses

Login to post response