Monday, March 17, 2008

ORACLE QUERIES

61) Display the names of the employees from department number 10 with

salary greater than that of all employee working in other departments.

SQL>select ename from emp where deptno=10 and sal>all(select sal from

emp where deptno not in 10).

62) Display the names of the employees in Uppercase.

SQL>select upper(ename)from emp

63) Display the names of the employees in Lowecase.

SQL>select lower(ename)from emp

64) Display the names of the employees in Propercase.

SQL>select initcap(ename)from emp;

65) Display the length of Your name using appropriate function.

SQL>select length('name') from dual

66) Display the length of all the employee names.

SQL>select length(ename) from emp;

67) select name of the employee concatenate with employee number.

SQL>select enameempno from emp;

68) User appropriate function and extract 3 characters starting from 2

characters from the following string 'Oracle'. i.e the out put should be 'ac'.

SQL>select substr('oracle',3,2) from dual

69) Find the First occurance of character 'a' from the following string i.e

'Computer Maintenance Corporation'.

SQL>SELECT INSTR('Computer Maintenance Corporation','a',1) FROM DUAL

70) Replace every occurance of alphabhet A with B in the string Allens(use

translate function)

SQL>select translate('Allens','A','B') from dual;

0 comments: