Up Up And Away !!
UPPER
Syntax: upper(variable)
Parameters:
Variable à String/Date Type/Number Type/Character
Return Type
If the variable is String/Char
type than it gets converted into upper case.
If the variable is Number
Type/Date Type then it gets converted into String type(VARCHAR) without
impacting its value.
Used Case:
(i) If Manager wants to fetch
details of employee with same surname. SQL consider entities with different
case as different entitles. So, by converting all in same case can fetch us
required data.
SELECT FIRST_NAME, LAST_NAME,
PHONE_NUMBER
FROM EMPLOYEES WHERE
UPPER(FIRST_NAME) = 'JOHN';
![]() |
(ii) In case manager wants the details of
employees with same hire date and salary to be displayed. In this case, upper()
could be used to convert number and date type in varchar so that comparison can
be done with given value.
SELECT * FROM EMPLOYEES
WHERE UPPER(HIRE_DATE)='25-JUN-97'
AND UPPER(SALARY)='4800';
Comments
Post a Comment