Assign 2

download Assign 2

If you can't read please download the document

description

assignment

Transcript of Assign 2

Lab Assignment2Based on Emp tableColumns are EmpNo, Ename, Job, Salary, Commission, DeptNOcreate table emp00(empno number(20),ename char(30),job char(20),sal number(20),deptno number(20),com number(10));Insert 5 records by stroring Null value in some records for commission column.insert into emp00 values(1,'shi','clerk',40000,30,NULL);insert into emp00 values(6,'raj','clerk',400,10,NULL);insert into emp00 values(8,'abha','saleperson',1500,50,NULL);insert into emp00 values(9,'fBahka','clek',1700,70,6);insert into emp00 values(10,'shit','cle',3000,10,3);Q1) Get employee no and employee name who works in dept no 10 ?select empno,ename from emp00 where deptno=10;Q2) Display the employee names of those clerks whose salary> 2000 ?select ename from emp00 where job='clerk'and sal>2000;Q3) Display name and job of Salesperson & Clerks ?select ename,job from emp00 where job in('saleperson','clerk');Q4) Display all details of employees whose salary between 2000 and 3000 ?select * from emp00 where sal between 2000 and 3000;Q5) Display all details of employees whose dept no is 10,20, or 30 ?select * from emp00 where deptno in(10,20,30);Q6) Display name of those employees whose commission is NULL ?select ename from emp00 where com is nullQ7) Display dept no & salary in ascending order of dept no and with in each dept no salary should be in descending order ?select deptno,sal from emp00 order by deptno,sal descQ8) Display name of employees having two a or A chars in the name ?select ename from emp00 where lower(ename) like '%a%a%';(or)select ename from emp00 where ename like '%a%a%' or ename like '%A%A%' or ename like '%A%a%' or ename like '%a%A%';Q9) Display the name of the employees whose second char is b or B ?select ename from emp00 where lower(ename) like '_b%' Q10) Display the name of the employees whose first or last char is a or A ?select ename from emp00 where trim(lower(ename)) like '%a' or lower(ename) like 'a%'Q11) Display maximum, minimum, average salary of deptno 10 employees.select max(sal),min(sal),avg(sal) from emp00 where deptno=10;Q12) Display total number of employees working in deptno 20select count(*) from emp00 where deptno=20;Q13) Display total salary paid to clerksselect sum(sal) from emp00 where job='clerk';Q14) Display system dateselect to_char(sysdate,'dd-mm-yyyy') from dual;(or) select sysdate from dual;Q15) Display the result of (12*12)/13select (12*12)/13 as calculation from dual;Q16) Display info of raj irrespective to the case in which the data is stored.select * from emp00 where lower(ename)='raj';