SELECT deptno FROM dept WHERE SUBSTR(dname,1,3) = 'ABC'
SELECT ename FROM emp WHERE job <> 'SALES'
SELECT * FROM emp WHERE ename IS NOT NULL
SELECT * FROM emp WHERE job LIKE 'AB%' AND empno = '7890
개선 전 | 개선 후 |
---|---|
SELECT dept, ename FROM emp WHERE SUBSTR(job, 1, 4)='SALE' | SELECT dept, ename FROM emp WHERE job LIKE 'SALE%' |
SELECT dept, ename FROM emp WHERE sal*12 = 100000 | SELECT dept, ename FROM emp WHERE sal = 100000/12 |
SELECT dept, ename FROM emp WHERE NVL(job, 'X') = 'SALE' | SELECT dept, ename FROM emp WHERE job = 'SALE' |
SELECT custno, chuldate
FROM chulgot
WHERE custno = 'DN01'
AND status = '90'
SELECT custno, chuldate
FROM chulgot
WHERE custno = 'DN01'
AND RTRIM(status) = '90'
SELECT x.ordno, x.ord_date, y.item, y.ordqty
FROM ORDER1T x, ORDER2T y
WHERE x.ordno = y.ordno
AND x.ord_date LIKE '9502%'
AND y.orddept = '12345'
ORDER BY ord_date
SELECT x.ordno, x.ord_date, y.item, y.ordqty
FROM ORDER1T x, ORDER2T y
WHERE x.ordno = y.ordno
AND x.ord_date LIKE '9502%'
AND RTRIM(y.orddept = '12345')
ORDER BY ord_date
SELECT sal_no, sale_date, sale_dept, saleqty
FROM mechult
WHERE sale_date LIKE '95%'
ORDER BY sale_dept
SELECT sal_no, sale_date, sale_dept, saleqty
FROM mechult
WHERE RTRIM(sale_date) LIKE '95%'
AND sale_dept > ''
{code:SQL} SELECT chr,num,var,dat FROM samplet WHERE chr = 10 {code} | ===> | {code:SQL} SELECT chr,num,var,dat FROM samplet WHERE to_number(chr) = 10 {code} |
SELECT *
FROM SAMPLET
WHERE DAT = '01-JAN-94'
SELECT 'Not found'
FROM EMP
WHERE EMPNO <> 7369
SELECT 'NOT FOUND'
FROM DUAL
WHERE NOT EXISTS
( SELECT 'X' FROM EMP
WHERE EMPNO = 7369 )
SELECT 'Not found'
FROM emp a
WHERE NOT EXISTS
(SELECT empno FROM emp b
WHERE b.empno = 7369
AND a.empno = b.empno)
1)
SELECT *
FROM TAB1
WHERE YYYYMM = '199910'
AND NOT EXISTS ( SELECT *
FROM TAB2
WHERE COL2 = COL1
AND YYYYMM = '199910')
2)
SELECT *
FROM TAB1
WHERE YYYYMM ='199910'
AND COL1 NOT IN (SELECT COL2
FROM TAB2
WHERE YYYYMM = '199910')
3)
SELECT *
FROM TAB1
WHERE (YYYYMM, COL1) IN (SELECT '199910', COL1
FROM TAB1
WHERE YYYYMM = '199910'
MINUS
SELECT '199910', COL2
FROM TAB2
WHERE YYYYMM = '199910')
SELECT *
FROM emp
WHERE ename IS NOT NULL
SELECT *
FROM emp
WHERE ename > ''
SELECT *
FROM emp
WHERE empno IS NOT NULL
SELECT *
FROM emp
WHERE empno > 0
SELECT ord_dept, ord_date, SUM(ord_qty), COUNT(*)
FROM?? order1t
WHERE? ord_no > 0
GROUP? BY ord_dept
???????? ,ord_date
ORDER? BY ord_date
SELECT *
FROM emp
WHERE ename IS NULL
CREATE TABLE emp(
ename VARCHAR2(20) DEFAULT '00'
......
)
SELECT ord_dept, SUM(ordqty), AVG(ordqty+asnqty), AVG(ordqty)
FROM ORDER
WHERE status < 'C'
GROUP BY ord_dept
SELECT ord_dept, ordqty
FROM ORDER1T
WHERE status = 'C'
AND ord_date like '9502%'
SELECT ord_dept, ordqty
FROM ORDER1T
WHERE status = 'C'
AND ord_date = '950201'
SELECT ord_dept, ordqty
FROM ORDER1T
WHERE ord_dept like '12%'
AND ord_date like '9502%'
SELECT *
FROM emp
WHERE ename > 'A'