One SQL master table record corresponds to multiple record statements in the attached table
In this case, we will use
Union statement
SQL union syntax
Select column_name (s) from table_name1
Union
Select column_name (s) from table_name2
Join left statement
Left join keyword syntax
Select column_name (s)
From table_name1
Left join table_name2
On table_name1.column_name = table_name2.column_name
Where subquery
Select * from a B where a. id = B. id
Here is an example.
Select xxxx from main table inner join appendix on main table. xxxx = appendix. xxxx where xxxx
Instance description.
Employees_china:
E_id e_name
01 zhang, hua
02 wang, wei
03 carter, thomas
04 yang, ming
Employees_usa:
E_id e_name
01 adams, john
02 bush, george
03 carter, thomas
04 gates, bill
List all different employee names in China and the United States:
Select e_name from employees_china
Union
Select e_name from employees_usa
Result
E_name
Zhang, hua
Wang, wei
Carter, thomas
Yang, ming
Adams, john
Bush, george
Gates, bill