JOIN
JOIN >>>> 카타시안곱 " x "같은 컬럼이 있으면 곱함....(공통점이 존재해야함)SELECT * FROM department, employee; >>>> 4X14 >>>공통점 dno EQUAL JOIN >>>> WHERE절에 " = "SELECT * FROM department, employee WHERE employee.dno = department.dno; >>>>중복배제(14출력)//사원번호,사원이름,소속부서 출력SELECT eno, ename, dname FROM employee, department WHERE employee.dno = department.dno and eno=7788;//테이블과 컬럼SELECT employee.eno, employee.ename, department...
예제#4
//그룹함수COUNT 행의개수SUM 열의 합 AVG 열의평균MIN 열의최소MAX열의 최대 //최근에 입사한사원, 가장 오래전에 입사한사원의 입사일출력SELECT MAX(hiredate), MIN(hiredate) FROM employee;//커미션총액SELECT SUM(commission) as "커미션총액" FROM employee;//전체사원의수SELECT COUNT(*) AS "사원의수" FROM employee;//커미션받는 사원의수 구하기 //널값은 빠짐SELECT COUNT(commission) as "커미션받는사원의수" FROM employee;//직업종류의 개수 출력SELECT COUNT(DISTINCT job) as "직업종류의 개수" FROM employee; //ORDER BY 컬럼기..
연습문제#2
SELECT ename, SUBSTR(hiredate, 1, 5) as "입사일" FROM employee; SELECT ename, hiredate FROM employee WHERE SUBSTR(hiredate, 4, 2)='04'; SELECT ename, eno FROM employee WHERE MOD(eno,2)=0; SELECT hiredate, TO_CHAR(hiredate, 'YY-MM DAY') FROM employee; SELECT ROUND(SYSDATE-TO_DATE('13/01/01')) FROM dual; SELECT manager, nvl(manager,'0') FROM employee; SELECT job, salary, DECODE(job, 'ANALYST', salary..