Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- 오손데이터읽기
- oracle
- 1759번
- 백준 1253번
- C++
- UnrealMP
- objtofbx
- Unreal
- 1967번
- 5639
- 언리얼 플러그인
- 언리얼 커스텀 플러그인
- 셰그먼트트리
- 데이터베이스 배움터
- Security
- hackerank
- 1253번
- command not found
- FBX
- 비재귀셰그먼트
- 민겸수
- 트랜잭션 관리
- SQL
- 의미와 무의미의 경계에서
- UActor
- Linux
- 백준
- OS
- 2단계로킹
- 실습
Archives
- Today
- Total
fatalite
Database Oracle SQL - 실습 4 본문
select * from employees;
#1번 문제
select max(salary) as "Maximum",
min(salary) as "Minimum",
sum(salary) as "Sum",
round(Avg(salary)) as "avg"
from employees;
#2번 문제
select
JOB_ID,
max(salary) as "Maximum",
min(salary) as "Minimum",
sum(salary) as "Sum",
round(Avg(salary)) as "avg"
from employees
group by JOB_ID
order by JOB_ID;
#3번 문제
select JOB_ID, count(JOB_ID) as "count"
from employees
group by JOB_ID;
#4번 문제
select SUM(count(JOB_ID)) as "Number of Manager"
from employees
group by JOB_ID
having JOB_ID LIKE '%MAN%'
OR JOB_ID LIKE '%MGR%';
#5번 문제
select MAX(salary) - MIN(salary) as "DIFFERENCE"
from employees;
#6번 문제
select
manager_id,
min(salary)
from employees
where manager_id IS NOT NULL
AND salary > 6000
group by manager_id
order by min(salary) desc;
#7번 문제
select
d.department_name,
d.location_id,
count(e.department_id) "number of people",
round(avg(e.salary),2) "salary"
from departments d ,employees e
where e.department_id = d.department_id
group by d.department_name, d.location_id ;
#8번 문제
SELECT
COUNT(*) total,
SUM(DECODE(TO_CHAR(hire_date, 'YYYY'), 2005, 1, 0)) "2005",
SUM(DECODE(TO_CHAR(hire_date, 'YYYY'), 2006, 1, 0)) "2006",
SUM(DECODE(TO_CHAR(hire_date, 'YYYY'), 2007, 1, 0)) "2007",
SUM(DECODE(TO_CHAR(hire_date, 'YYYY'), 2008, 1, 0)) "2008"
FROM employees;
#9번 문제
select JOB_ID,
sum(decode(DEPARTMENT_ID, 20, salary,0)) "DEPT 20",
sum(decode(DEPARTMENT_ID, 50, salary,0)) "DEPT 50",
sum(decode(DEPARTMENT_ID, 70, salary,0)) "DEPT 70",
sum(decode(DEPARTMENT_ID, 90, salary,0)) "DEPT 90",
sum(salary) "TOTAL"
from employees
group by JOB_ID
order by job_id;
'컴퓨터 공학 > Database 데이터베이스' 카테고리의 다른 글
TRANSACTION with Oracle SQL (0) | 2022.12.13 |
---|---|
VIEW & CATALOG with Oracle SQL (0) | 2022.12.13 |
Oracle SQL - 테이블 변경 및 생성 (0) | 2022.12.11 |
Database Oracle SQL - 실습 6 (0) | 2022.12.11 |
Database Oracle SQL - 실습 5 (0) | 2022.12.11 |