본문 바로가기

스터디35

[Oracle] NVL, NVL2, NULLIF, DECODE, COALESCE, CASE WHEN NVL(칼럼, 변환 수) - NULL을 다른값으로 치환 select ename, sal, comm, NVL(comm, 1) , sal + NVL(comm, 0) from emp; NVL2(칼럼, 변환 값1, 변환 값2) 칼럼이 NULL이 아닌 경우에는 변환값1, NULL인 경우 변환값2 변환값1, 변환값 2는 데이터 입이 동일해야 함 select ename, comm, NVL2(comm, comm+700, 100) from emp; select player_name, nation, NVL2(nation, nation, '한국'), NVL2(nation, nation||'인', '한국인') from player; NULLIF(칼럼, 비교 값) - 비교 값 또는, NULL 반환 칼럼 값 == 비교 값 이면 .. 2023. 6. 20.
[Oracle / 오라클] 집합 연산자 UNION, UNION ALL, MINUS, INTERSECT 오라클에서 사용하는 4가지 종류 집합 연산자 종류 설명 UNION - 합집합 중복값 제거 UNION ALL - 합집합 중복값 허용, 속도 빠름, MINUS - 차집합 앞의 SELECT 에서 다음 SELECT 에 존재하지 않는 데이터만 출력 INTERSECT - 교집합 앞의 SELECT 와 다음 SELECT 의 결과 값이 같은 데이터만 출력 UNION SELECT employee_id, last_name, salary, department_id from employees; SELECT employee_id, last_name, salary, department_id from employees where department_id = 10 union SELECT employee_id, last_name, sa.. 2023. 6. 19.
[Oracle / 오라클] group by, count, sum tb_department 테이블 조회 select * from tb_department; tb_student 테이블 조회 select * from tb_student; SELECT d.department_name, a.* FROM ( SELECT department_no, COUNT(student_no) count FROM tb_student GROUP BY department_no ) a, tb_department d WHERE a.department_no = d.department_no ORDER BY count DESC; select * from departments; select * from employees select 하고자 하는 department_id, department_name 은 gr.. 2023. 6. 19.
[JQuery] 조건부 서브 셀렉트(Sub select) 생성 $(document).ready(function() { var selectOptions = { 'Option 1': { 'value': 'option1', 'subOptions': { 'Suboption 1A': 'suboption1a', 'Suboption 1B': 'suboption1b' } }, 'Option 2': { 'value': 'option2', 'subOptions': { 'Suboption 2A': 'suboption2a', 'Suboption 2B': 'suboption2b' } }, 'Option 3': { 'value': 'option3', 'subOptions': { 'Suboption 3A': 'suboption3a', 'Suboption 3B': 'suboption3b' } .. 2023. 6. 4.