CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
DanielBarnes18

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: DanielBarnes18/IBM-Data-Science-Professional-Certificate
Path: blob/main/06. Databases and SQL for Data Science with Python/03. Intermediate SQL/04. Working with Multiple Tables/SubQueries_Solution_Script.sql
Views: 4606
1
2
--- Query 1 ---
3
select *
4
from employees
5
where salary < AVG(salary)
6
;
7
--- Query 2---
8
select EMP_ID, F_NAME, L_NAME, SALARY
9
from employees
10
where SALARY <
11
(select AVG(SALARY)
12
from employees)
13
;
14
--- Query 3 ---
15
select EMP_ID, SALARY, MAX(SALARY) AS MAX_SALARY
16
from employees
17
;
18
--- Query 4 ---
19
select EMP_ID, SALARY, ( select MAX(SALARY) from employees ) AS MAX_SALARY
20
from employees
21
;
22
--- Query 5 ---
23
select *
24
from ( select EMP_ID, F_NAME, L_NAME, DEP_ID from employees) AS EMP4ALL
25
;
26