Preparation (two sheet t1,t2):
Table T1:
Mysql> select * from T1;
+-------+---------+
| t1_id | T1_name |
+-------+---------+
| 1 | T1_1 |
| 2 | t1_2 |
+-------+---------+
2 rows in Set (0.02 sec)
Table T2:
Mysql> select * from T2;
+-------+---------+
| t2_id | T2_name |
+-------+---------+
| 2 | t2_2 |
| 3 | T2_3 |
+-------+---------+
2 rows in Set (0.03 sec)
Example of a set:
Mysql> Select T1.t1_id,t2.t2_id,t1.t1_name from T1 left joins T2 on t1.t1_id=t2.t2_id;
+-------+-------+---------+
| t1_id | t2_id | T1_name |
+-------+-------+---------+
| 1 | NULL | T1_1 |
| 2 | 2 | t1_2 |
+-------+-------+---------+
2 rows in Set (0.02 sec)
Intersection instance:
Mysql> Select T1.t1_id,t2.t2_id,t1.t1_name from T1,t2 where t1.t1_id=t2.t2_id;
+-------+-------+---------+
| t1_id | t2_id | T1_name |
+-------+-------+---------+
| 2 | 2 | t1_2 |
+-------+-------+---------+
1 row in Set (0.01 sec)
MySQL query, left join (Seek and set), where (intersection)