1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | SQL> SELECT ENAME AS 사원이름, EMPNO AS 사원번호, HIREDATE AS 고용일 FROM EMP ORDER BY 사원번호 DESC; 사원이름 사원번호 고용일 ---------- ---------- -------- MILLER 7934 82/01/23 FORD 7902 81/12/03 JAMES 7900 81/12/03 ADAMS 7876 87/05/23 TURNER 7844 81/09/08 KING 7839 81/11/17 SCOTT 7788 87/04/19 CLARK 7782 81/06/09 BLAKE 7698 81/05/01 MARTIN 7654 81/09/28 JONES 7566 81/04/02 사원이름 사원번호 고용일 ---------- ---------- -------- WARD 7521 81/02/22 ALLEN 7499 81/02/20 SMITH 7369 80/12/17 14 개의 행이 선택되었습니다. | cs |
1 2 3 4 5 6 7 | SQL> SELECT EMPNO, ENAME, JOB, SAL FROM EMP WHERE SAL BETWEEN 3000 AND 5000; EMPNO ENAME JOB SAL ---------- ---------- --------- ---------- 7788 SCOTT ANALYST 3000 7839 KING PRESIDENT 5000 7902 FORD ANALYST 3000 | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | SQL> SELECT DEPTNO, ENAME, JOB, SAL*3 AS SAL FROM EMP; DEPTNO ENAME JOB SAL ---------- ---------- --------- ---------- 20 SMITH CLERK 2400 30 ALLEN SALESMAN 4800 30 WARD SALESMAN 3750 20 JONES MANAGER 8925 30 MARTIN SALESMAN 3750 30 BLAKE MANAGER 8550 10 CLARK MANAGER 7350 20 SCOTT ANALYST 9000 10 KING PRESIDENT 15000 30 TURNER SALESMAN 4500 20 ADAMS CLERK 3300 DEPTNO ENAME JOB SAL ---------- ---------- --------- ---------- 30 JAMES CLERK 2850 20 FORD ANALYST 9000 10 MILLER CLERK 3900 14 개의 행이 선택되었습니다. | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | SQL> SELECT EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO FROM EMP WHERE (JOB = 'CLERK' OR JOB = 'ANALYST') AND SAL NOT IN (1000,3000,5000); EMPNO ENAME JOB MGR HIREDATE SAL COMM ---------- ---------- --------- ---------- -------- ---------- ---------- DEPTNO ---------- 7369 SMITH CLERK 7902 80/12/17 800 20 7876 ADAMS CLERK 7788 87/05/23 1100 20 7900 JAMES CLERK 7698 81/12/03 950 30 EMPNO ENAME JOB MGR HIREDATE SAL COMM ---------- ---------- --------- ---------- -------- ---------- ---------- DEPTNO ---------- 7934 MILLER CLERK 7782 82/01/23 1300 10 | cs |
1 2 3 4 5 6 7 8 9 10 11 12 | SQL> SELECT EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO FROM EMP WHERE ENAME LIKE 'M%'; EMPNO ENAME JOB MGR HIREDATE SAL COMM ---------- ---------- --------- ---------- -------- ---------- ---------- DEPTNO ---------- 7654 MARTIN SALESMAN 7698 81/09/28 1250 1400 30 7934 MILLER CLERK 7782 82/01/23 1300 10 | cs |
1 2 3 4 5 6 7 8 | SQL> SELECT JOB, COUNT(job) AS COUNT FROM EMP GROUP BY JOB HAVING COUNT(job) >=3; JOB COUNT --------- ---------- CLERK 4 SALESMAN 4 MANAGER 3 | cs |
'Database > SQL' 카테고리의 다른 글
[SQL] SELECT 문 실습 - 조인 쿼리, 서브 쿼리 (0) | 2018.03.05 |
---|---|
[SQL] SELECT 문 실습 - 데이터 변경(2) (0) | 2018.03.05 |
[SQL] SELECT 문 실습 - 데이터 변경 (0) | 2018.03.05 |