본문 바로가기

Database

[ORACLE]다중행함수(그룹함수) 계속 oracle 다중행함수(그룹함수) 계속 select employee_id, last_name, job_id, salary from hr.employees where job_id like '%MAN%' and salary >= 10000; select last_name, job_id, salary from hr.employees where (job_id = 'SA_REP' or job_id = 'AD_PRES' ) and salary > 15000; select last_name, job_id, salary from hr.employees where job_id in ('SA_REP','AD_PRES') and salary > 15000; --- 90인부서 30부서의 사원들을 구하시오. select * f.. 더보기
[ORACLE] 다중행함수(그룹함수) oracle 다중행함수(그룹함수) ---다중행함수(그룹함수) --select 다중행 함수 --from 프로젝션 --where 셀렉션 --group by 다중행 함수를 사용하기위한 조건 --having 다중행함수 결과에 대한 조건 --order by 정렬하기 위한조건(값을 다가져와서 정렬을 하므로 얘는 항상 마지막) --직원의 총 수를 구해보자. select * from hr.employees; select count(employee_id) from hr.employees; --사원급여의 총합계를 구하시오. select sum(salary) from hr.employees; --사원급여의 평균을 구하시오 select trunc(avg(salary),0) from hr.employees; --급여를 제일 많.. 더보기
[ORACLE]3일차_함수사용_데이터가공옵션 oracle 함수사용_데이터가공옵션 ---데이터 베이스 내장함수 --단일행 함수 : 하나의 행의 값만을 인자값으로 사용하는 함수 --다중행 함수 : 여러개의 행을 인자값으로 사용하는 함수 ---함수는 자바와 같이 인자값이 여러개라고 하더라도 반환값이 하나이다 ---함수를 믹서기로 비교한다면 믹서기에 여러개의 재료를 넣어도 나오는 결과는 --- 믹스된 결과인 하나만 가져오는 것과 같다. -----lower함수(모두소문자로) select first_name, email, job_id from hr.employees; select first_name, lower(first_name) low_first, email, lower(email) low_e, job_id, lower(job_id) low_j from .. 더보기
[ORACLE] AND&OR oracle AND&OR --두번째 글자가 s로 시작되는 이름을 찾아서 모두 출력하시오 select * from hr.employees where first_name like '_s%'; --세번째 글자가 s로 시작되는 이름을 찾아서 모두 출력하시오 select * from hr.employees where first_name like '__s%'; --뒤에서 부터 두번째 글자가 s인 사원을 출력하시오 select * from hr.employees where first_name like '%s_'; --이름이 세번째 글자는 s 그리고 5번째는 o인 사원을 출력하시오 select * from hr.employees where first_name like '__s_o%'; -----------and 연산자.. 더보기
[ORACLE] 셀렉션 oracle 셀렉션 select * from hr.employees where employee_id=112; ---------------------이름이 steven인 사원을 출력하시오--------------------- select * from hr.employees where first_name = 'Steven'; ---------------------이메일이 SKING인 사원을 출력하시오--------------------- select*from hr.employees where email = 'SKING'; --------------------부서가 90인 사원들을 출력하시오------------------------- select * from HR.employees where departme.. 더보기
[ORACLE] 프로젝션 oracle 프로젝션 select * from hr.departments; select department_id, department_name, manager_id, location_id from hr.departments; select * from hr.employees; select employee_id, first_name, hire_date, salary, salary*12, salary+300 from hr.employees; ----직원의 사원번호, 이름, 입사일, 급여, 급여에 300을 더한것에 연봉까지 출력!!----- select employee_id, first_name, hire_date, salary, salary+300, (salary+300)*12 from hr.employees.. 더보기
[ORACLE]2일차_사용자 생성_권한_HTTP포트설정_SYSTEM oracle 이론 및 사용자 생성_권한_HTTP포트설정_SYSTEM 1. 데이터의 행을 레코드 또는 row라고 한다. 2.heading name : column명이라고 한다. 3.null : 값이 존재하지 않는다는 것이 아니라, 빈값이라는 말도 아니다. 알 수 없는 값이라는 뜻이다. 즉 내가 입력하지 않은 값이다. 4.null : 알 수없는 값에다가 연산을 한다고 하더라도 알수없는 값이된다. null값에 어떠한 연산을 한다고 하더라도 null값은 그냥 널이다. 5.헤딩네임에 어떠한 연산식을 추가하여 값을 가져오면 연산식 자체가 헤딩 네임이 되는데 그것을 별칭을 사용할 수있다. 6.자바에서 쿼리문을 사용할때 테이블명이나 컬럼명은 대소문자 구별하지 않는다. 7.임의로 주는 값을 리터널이라고 하는데 문자열을줄.. 더보기
[ORACLE]1일차_계정생성_포트설정 oracle 계정생성_포트설정 conn /as sysdba create user smrit identified by oracle; //사용자 계정생성(oracle가 암호) grant connect, resource, dba to smrit; //권한부여 dba권한을줌 스므릿한테 drop user smrit; //사용자 계정 삭제 select dbms_xdb.gethttpport() from dual; //http 포트를 가져옴 exec dbms_xdb.sethttpport(9000);//http포트를 9000번으로 셋팅함 select dbms_xdb.gethttpport() from dual; conn smrit /oracle 더보기