quries

1) Give the details of employees who have been hired between 09-JUN-81 And 31-DEC-04.
a) select * from emp where hiredate between '09-JUN-81' And 31-DEC-04


2)Write a query to display dept no , lowest salary and highest salary in each department.
a) select deptno,min(sal),max(sal) from emp group by deptno;


3)Write a query to display the tomorrow date and next week date.
a)select sysdate+1,next_day(sysdate,'saturday') from dual;


4)Write a query to display the dates for one day after and one day before.
a)select sysdate+1,sysdate-1 from dual;


5)Write a query to display the system date and previous date.
a)select sysdate,sysdate-1 from dual;

6) Write a query to display the current date and time.
a)select to_char(to_date(sysdate,'dd-mm-yyyy'),'dd-hh24:mi:ss') from dual;


7)List the names, dept of all employees whose hire date anniversary does exits in the first quarter of the year.
a)select ename,deptno where to_char(hiredate,'q')<>1;

8)Find Century in which BALKE joined.
a)select to_char(hiredate,'cc') from emp where ename='BLAKE';


9)Find out which quarter of the year the employees joined.
a)select to_char(hiredate, 'q') from emp;

10)List the names and hire date of the employees in dept no 20, display hire date formated as 12/03/1984.
a) select to_char(hiredate,'dd/mm/yyyy') from emp where deptno=20;

No comments:

Post a Comment

Template Design by faris vio