Case conversion function used to display character values in a different case,without changing the case of the data in the table
Types of case conversion function
1- UPPER: that display all characters in lowercase
2- LOWER: displays all character in lowercase.
3- INITCAP: converts the first letter or each word to uppercase and the remaining litters to lowercase.
Syntax of Case Conversion Function
First you type the keyword then the character data that you want to convert, enclosed in parentheses.
Examples
SELECT LOWER(ENAME) EMPLOYEE
FROM EMP;
Types of case conversion function
1- UPPER: that display all characters in lowercase
2- LOWER: displays all character in lowercase.
3- INITCAP: converts the first letter or each word to uppercase and the remaining litters to lowercase.
Syntax of Case Conversion Function
First you type the keyword then the character data that you want to convert, enclosed in parentheses.
Examples
SELECT LOWER(ENAME) EMPLOYEE
FROM EMP;
EMPLOYEE
----------
smith
allen
ward
jones
martin
blake
clark
scott
king
turner
adams
EMPLOYEE
----------
james
ford
miller
SELECT UPPER(ENAME) EMPLOYEE
FROM EMP;
EMPLOYEE
----------
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
EMPLOYEE
----------
JAMES
FORD
MILLER
SELECT INITCAP(ENAME) EMPLOYEE
FROM EMP;
EMPLOYEE
----------
Smith
Allen
Ward
Jones
Martin
Blake
Clark
Scott
King
Turner
Adams
EMPLOYEE
----------
James
Ford
Miller
Case conversion functions used in the WHERE clause
FOR EXAMPLE CHECK THE DIFFERNET IN BELOW
SELECT ENAME
FROM EMP
Where ename=’adams’
no rows selected
SELECT ENAME
FROM EMP
Where lower(ename)=’adams’
ENAME
----------
ADAMS
No comments:
Post a Comment