0% found this document useful (0 votes)
29 views3 pages

Select Ename From Emp Select Ename From Emp - All

This document contains multiple SQL queries that select, filter, calculate, group, and join data from EMP and DEPT tables. The queries retrieve employee names, salaries, departments, jobs, hire dates, and total compensation. They apply filters on department numbers, salaries, hire dates, and jobs. Some queries calculate totals, counts, and annual salaries. Others order or group results.

Uploaded by

Himanshu Kashyap
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views3 pages

Select Ename From Emp Select Ename From Emp - All

This document contains multiple SQL queries that select, filter, calculate, group, and join data from EMP and DEPT tables. The queries retrieve employee names, salaries, departments, jobs, hire dates, and total compensation. They apply filters on department numbers, salaries, hire dates, and jobs. Some queries calculate totals, counts, and annual salaries. Others order or group results.

Uploaded by

Himanshu Kashyap
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Select ename from emp Select *ename from emp-----all SELECT ename,sal*12 as "annual_sal" FROM EMP; SELECT job

FROM EMP; SELECT distinct job FROM EMP; SELECT * FROM EMP order by sal SELECT * FROM EMP order by sal desc SELECT * FROM EMP order by deptno , sal desc SELECT * FROM emp where deptno=10 SELECT * FROM emp where deptno=10 or sal>=2000 SELECT * FROM emp where deptno=10 or deptno=20 SELECT * FROM emp where deptno in (10,20,30) SELECT * FROM emp where job in ('salesman','clerk','analyst') SELECT *

FROM emp where sal between 1000 and 3000 SELECT * FROM emp where deptno in (10,20) and sal>=3000 SELECT * FROM emp where comm>0 SELECT * FROM emp where comm is not null SELECT * FROM emp where ename like 's*' SELECT Mid(ename,2,3) AS Expr1 FROM emp; SELECT * FROM emp where year(hiredate)=1982 SELECT * FROM emp where hiredate>cdate("12-jan-1982") SELECT ename,sal,comm, iif(comm is null,sal,sal+comm) as total_sal from emp SELECT sum(sal) FROM EMP; SELECT count(sal) FROM EMP; Select deptno, job,sum(sal) from emp group by deptno,job Select deptno, sum(sal) from emp group by deptno having sum(sal)>=9000 select ename, dname from emp, dept where emp.deptno=dept.deptno

Select ename, loc from emp e, dept d Where e.deptno = d.deptno and e.ename = 'ALLEN'

You might also like