-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQLQuery8 -COMPLEX CODE.sql
More file actions
22 lines (16 loc) · 1.03 KB
/
SQLQuery8 -COMPLEX CODE.sql
File metadata and controls
22 lines (16 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
select * from current_salaries
select * from current_salaries join current_dept_emp on current_dept_emp.emp_no = current_salaries.emp_no
order by dept_no
select dept_no, max(salary)
select * from current_salaries join current_dept_emp on current_dept_emp.emp_no = current_salaries.emp_no
order by dept_no
select dept_no, SUM(CAST(salary AS bigint)) as total
from current_salaries join current_dept_emp on current_dept_emp.emp_no = current_salaries.emp_no
group by dept_no order by total desc
select * from current_salaries join current_dept_emp on current_dept_emp.emp_no = current_salaries.emp_no
select dept_no, SUM(CAST(salary AS bigint)) as total
from current_salaries join current_dept_emp on current_dept_emp.emp_no = current_salaries.emp_no
group by dept_no order by total desc having total> 2000000000
select dept_no, SUM(CAST(salary AS bigint)) as total
from current_salaries join current_dept_emp on current_dept_emp.emp_no = current_salaries.emp_no
group by dept_no order by total desc having SUM(CAST(salary AS bigint))> 2000000000