Scenario 1: Find the same row in two or more tables. ( intersection )
SELECT empno,ename FROM emp
intersect
select empno,ename from emp_bonus;
Scenario 2: Find out the records in table 1 but not in table 2. For example, query all employees who have not received bonuses. ( difference set )
SELECT empno,ename FROM emp
minus
select empno,ename from emp_bonus;
Thinking: Why not use not in or not exists
Scenario 3: Summarize all people. ( union )
union (will remove duplicate records, deduplication rule: all columns of the query have the same value)
union all (no deduplication)