Oracle 연습문제 . 데이터입력
CREATE TABLE EMP (EMPNO NUMBER(4) NOT NULL PRIMARY KEY, ENAME VARCHAR2(10), JOB VARCHAR2(9), HIREDATE DATE, SAL NUMBER(7, 2), COMM NUMBER(7, 2), DEPTNO NUMBER(2)); INSERT INTO EMP VALUES (7369, 'SMITH', 'CLERK', TO_DATE('17-12-1980', 'DD-MM-YYYY'), 800, NULL, 20);INSERT INTO EMP VALUES (7499, 'ALLEN', 'SALESMAN', TO_DATE('20-02-1981', 'DD-MM-YYYY'), 1600, 300, 30);INSERT INTO EMP VALUES (7521, '..
2012. 9. 24.
/*Over(partition by)*/ /*inner query*/
/*Over(partition by)*/ select employee_id, last_name, department_name, salaryfrom ( select employee_id, last_name,salary, department_name, max(salary) over (partition by d.department_id) as maxsal from employees e join departments d on e.department_id=d.department_id )where maxsal=salaryorder by employee_id asc; /*inner query*/select employee_id, last_name, department_name, salaryfrom employees ..
2012. 9. 24.
20120831 Oracle
3.1) EMPLOYEES Table에서 이름, 급여를 구하여 급여가 많은사람에서 적은사람 순서로 출력하여라. select first_name, last_name, salary from employees order by salary DESC; 3.2) 10번 부서의 모든 사람들에게 급여의 13%를 보너스로 지불하기로 하였다.이름, 급여, 보너스 금액, 부서번호를 출력하여라. select emp.first_name,emp.last_name,emp.salary,emp.salary*0.13 "Bonus",emp.department_id from employees emp, departments depa where emp.department_id=10 and emp.department_id = depa.depar..
2012. 9. 2.