-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.sql
More file actions
73 lines (65 loc) · 1.34 KB
/
code.sql
File metadata and controls
73 lines (65 loc) · 1.34 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
CREATE TABLE emp049 (
ename VARCHAR2(20),
deptid NUMBER(2)
);
CREATE TABLE department049 (
deptid NUMBER(2),
deptname VARCHAR(15)
);
desc EMP049;
desc Department049;
EMP
INSERT INTO EMP049 VALUES ('Baby Yoda', 01);
INSERT INTO EMP049 VALUES ('Din Djarin', 21);
INSERT INTO EMP049 VALUES ('Boba Fett', 02);
INSERT INTO EMP049 VALUES ('Master Luke', 10);
INSERT INTO EMP049 VALUES ('Kylo Ren', 03);
Dept
INSERT INTO Department049 VALUES (01, 'Operations');
INSERT INTO Department049 VALUES (02, 'Management');
INSERT INTO Department049 VALUES (03, 'Sales');
INSERT INTO Department049 VALUES (69, 'Finance');
INSERT INTO Department049 VALUES (18, 'HR');
-- 1. Display all the dept numbers available with the dept and emp tables avoiding duplicates.
(SELECT DeptId FROM EMP049) UNION (SELECT DeptId FROM Department049);
2. Display all the dept numbers available with the dept and emp tables.
(
SELECT
deptid
FROM
emp049
)
UNION ALL
(
SELECT
deptid
FROM
department049
);
--3. Display all the dept numbers available in emp and not in dept tables and vice versa.
(
SELECT
deptid
FROM
emp049
)
MINUS
(
SELECT
deptid
FROM
department049
);
(
SELECT
deptid
FROM
department049
)
MINUS
(
SELECT
deptid
FROM
emp049
);