0% found this document useful (0 votes)
14 views5 pages

Exemplo Consulta Where

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

Exemplo Consulta Where

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

select ename, sal

from scott.emp
where sal> 2850;
> < >= <= <>

SELECT ename, job, deptno


from scott.emp
WHERE job ='CLERK';

SELECT ename, job, deptno


from scott.emp
WHERE job='clerk';

SELECT ename, sal, comm


from scott.emp
WHERE sal<=comm;

SELECT ename, sal, comm, comm*1.1


from scott.emp
WHERE sal< comm *1.1 ;
SELECT ename, sal
from scott.emp
WHERE sal BETWEEN 1000 AND 1500;

SELECT empno, ename, sal, job


from scott.emp
WHERE job IN ('MANAGER','SALESMAN', 'CLERK');

% - qualquer coisa
_ - qualquer letra

SELECT ename
from scott.emp
WHERE ename LIKE 'S%';

SELECT ename
from scott.emp
WHERE ename LIKE '%N';
SELECT ename
from scott.emp
WHERE ename LIKE '%A%';

SELECT ename
FROM scott.emp
WHERE ename LIKE '__A%';

SELECT ename
FROM scott.emp
WHERE ename LIKE '%E_';

SELECT ename, comm


from scott.emp
WHERE comm IS NULL;

SELECT ename, comm


from scott.emp
WHERE comm IS not NULL;

SELECT ename, sal


from scott.emp
WHERE sal not BETWEEN 1000 AND 1500;

SELECT ename
from scott.emp
WHERE ename not LIKE 'S%';
SELECT empno, ename, sal, job
from scott.emp
WHERE job not IN ('MANAGER','SALESMAN', 'CLERK');

SELECT empno, ename, job, sal


from scott.emp
WHERE sal>=1100
AND job='CLERK';

SELECT empno, ename, job, sal


from scott.emp
WHERE sal>=1100
OR job='CLERK';

SELECT ename, job, deptno, hiredate


from scott.emp
ORDER BY hiredate;

SELECT ename, job, deptno, hiredate


from scott.emp
ORDER BY hiredate DESC;

SELECT ename, job, deptno, hiredate


from scott.emp
ORDER BY ename;

SELECT ename, deptno, sal


from scott.emp
ORDER BY deptno, sal DESC;

You might also like