50 oueries solution

50 oueries solution - ASSSIGNMENT OF 50 QUERIES by...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
ASSSIGNMENT OF 50 QUERIES by SREEKANTH KONDA AKHIL PRASAD PITTA 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1)Display names and job of employees who is CLERK. select ename,job from emp where job like 'CLERK'; o/p-------------------------- ENAME JOB ---------- --------- SMITH CLERK ADAMS CLERK JAMES CLERK MILLER CLERK 2)Display names and department whose job is a ANALYST or CLERK. select ename,deptno from emp where job in('ANALYST','CLERK'); o/p-------------------------- ENAME DEPTNO ---------- --------- SMITH 20 SCOTT 20 ADAMS 20 JAMES 30 FORD 20 MILLER 10 3)Give list of employees sorted on names. select ename from emp order by ename; o/p----------------------------- ENAME ---------- ADAMS ALLEN BLAKE CLARK FORD JAMES JONES KING MARTIN MILLER SCOTT SMITH TURNER WARD 2
Background image of page 2
4)Display different kinds of jobs available. select distinct job from emp; o/p------------------------- JOB --------- ANALYST CLERK MANAGER PRESIDENT SALESMAN 5)Find location’s of employess. select ename ,loc from emp,dept where emp.deptno=dept.deptno; o/p-------------------------------- ENAME LOC ---------- ------------- SMITH DALLAS ALLEN CHICAGO WARD CHICAGO JONES DALLAS MARTIN CHICAGO BLAKE CHICAGO CLARK NEW YORK SCOTT DALLAS KING NEW YORK TURNER CHICAGO ADAMS DALLAS JAMES CHICAGO FORD DALLAS MILLER NEW YORK 6)Display names ,salary of employees who is staying in BOSTON. select ename ,sal from emp e,dept d where e.deptno=d.deptno and d.loc='BOSTON'; o/p------------------------------------ no rows selected 7)Display names of employees whose department is 30. select ename from emp where deptno=30; o/p------------------------------------- ENAME ---------- ALLEN WARD MARTIN BLAKE TURNER JAMES 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8)Select all the employees whose names are 4 letters long. select ename from emp where ename like '____'; o/p-------------------------------- ENAME ---------- WARD KING FORD 9)Select all the employees whose names end with ‘R’. select ename from emp where ename like '%R'; o/p----------------------------------- ENAME ---------- TURNER MILLER 10)Display the names of employees working in SALES or RESEARCH department. select e.ename,e.empno,d.deptno from emp e,dept d where e.deptno=d.deptno and d.dname in ('SALES','RESEARCH'); o/p------------------------------------ ENAME EMPNO DEPTNO ---------- --------- --------- SMITH 7369 20 ALLEN 7499 30 WARD 7521 30 JONES 7566 20 MARTIN 7654 30 BLAKE 7698 30 SCOTT 7788 20 TURNER 7844 30 ADAMS 7876 20 JAMES 7900 30 FORD 7902 20 11)Display the department whose dept number is less than 20. select dname from dept where deptno<20; o/p------------------------------------ DNAME -------------- ACCOUNTING 4
Background image of page 4
12)Find out the department in which maximum employees work select dname,deptno from dept, (select count(*) ct,deptno de from emp group by deptno) a where a.de=deptno and a.ct= (select max(count(*)) from emp group by deptno); o/p------------------------------------- DNAME DEPTNO -------------- --------- SALES 30 13)Display job,department,name of employees whose name start with ‘B’ or ‘M’. select e.job,d.dname,e.ename
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/15/2011 for the course ECO 2023 taught by Professor Mr.raza during the Summer '10 term at FAU.

Page1 / 15

50 oueries solution - ASSSIGNMENT OF 50 QUERIES by...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online