select * from employees;
-- 오라클에서 문자열끼리 더하려면 || 기호를 사용한다
-- as 를 이용하여 컬럼이름을 내가 원하는 형태로 수정할 수 있다
select first_name, last_name, salary from employees;
select first_name || ' ' || last_name as name, salary from employees;
select max(salary) from employees; -- 가장 높은 급여
select max(hire_date) from employees; -- 가장 나중에 입사할 날짜
select min(salary) from employees; -- 가장 낮은 급여
select min(hire_date) from employees; -- 가장 먼저 입사한 날짜
select count(*) from employees; -- 전체 직원수 107명
select sum(salary) from employees; -- 월간 급여로 지출되는 총 금액
select avg(salary) from employees; -- 직원들의 평균 월급
-- 두개 이상의 컬럼을 조회하면서 집계함수를 사용하는 예시
select max(salary), job_id from employees
group by job_id
order by max(salary) desc;
select first_name, salary, job_id from employees
where job_id = 'IT_PROG';
-- 각 부서별 인원 수를 파악하세요
-- x에 따른 y를 파악하세요
select job_id, count(*) from employees
where job_id = 'IT_PROG'
group by job_id
order by count(*) desc;
select department_id, MIN(salary) from employees
group by department_id;