By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
CREATE TABLE
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
| empid | name | dept_id | salary |
|---|---|---|---|
| 1 | Rob | 1 | 100 |
| 2 | Mark | 1 | 300 |
| 3 | John | 2 | 100 |
| 4 | Mary | 2 | 300 |
| 5 | Bill | 3 | 700 |
| 6 | Jose | 6 | 400 |
SELECT 6
| deptid | name |
|---|---|
| 1 | IT |
| 2 | Accounts |
| 3 | Security |
| 4 | HR |
| 5 | R&D |
SELECT 5
| empid | name | dept_name |
|---|---|---|
| 1 | Rob | IT |
| 2 | Mark | IT |
| 3 | John | Accounts |
| 4 | Mary | Accounts |
| 5 | Bill | Security |
SELECT 5
| empid | name | dept_name |
|---|---|---|
| 1 | Rob | IT |
| 2 | Mark | IT |
| 3 | John | Accounts |
| 4 | Mary | Accounts |
| 5 | Bill | Security |
| 6 | Jose | null |
SELECT 6