-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lab_6.sql
48 lines (40 loc) · 831 Bytes
/
Lab_6.sql
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--Lab_6
--SQL Ser operators
--Question 1.
SELECT department_id
FROM employees MINUS
SELECT department_id
FROM employees
WHERE job_id = 'ST_CLERK'
--Question 2.
SELECT country_id,
country_name
FROM countries MINUS
SELECT country_id,
country_name
FROM countries c
JOIN locations l USING(country_id)
JOIN departments d USING(location_id)
WHERE department_id IS NOT NULL;
--Question 3.
SELECT DISTINCT job_id,
department_id
FROM employees
WHERE department_id = 10
UNION ALL
SELECT DISTINCT job_id,
department_id
FROM employees
WHERE department_id = 50
UNION ALL
SELECT DISTINCT job_id,
department_id
FROM employees
WHERE department_id = 20;
--Question 4.
SELECT employee_id,
job_id
FROM employees INTERSECT
SELECT employee_id,
job_id
FROM job_history