rendered paste bodymysql> create table t1 ( i int, j int);
Query OK, 0 rows affected (0.06 sec)
mysql> create table t2 ( i int, j int);
Query OK, 0 rows affected (0.06 sec)
mysql> insert into t1 values (1,1),(2,2),(2,3),(3,9);
Query OK, 4 rows affected (0.02 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> insert into t2 values (1,10),(1,11),(2,20),(10,10);
Query OK, 4 rows affected (0.02 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> select * from t1 left join t2 on t1.i=t2.i;
+------+------+------+------+
| i | j | i | j |
+------+------+------+------+
| 1 | 1 | 1 | 10 |
| 1 | 1 | 1 | 11 |
| 2 | 2 | 2 | 20 |
| 2 | 3 | 2 | 20 |
| 3 | 9 | NULL | NULL |
+------+------+------+------+
5 rows in set (0.00 sec)
mysql> select * from t1 inner join t2 on t1.i=t2.i;
+------+------+------+------+
| i | j | i | j |
+------+------+------+------+
| 1 | 1 | 1 | 10 |
| 1 | 1 | 1 | 11 |
| 2 | 2 | 2 | 20 |
| 2 | 3 | 2 | 20 |
+------+------+------+------+
4 rows in set (0.00 sec)
mysql> select * from t1 right join t2 on t1.i=t2.i;
+------+------+------+------+
| i | j | i | j |
+------+------+------+------+
| 1 | 1 | 1 | 10 |
| 1 | 1 | 1 | 11 |
| 2 | 2 | 2 | 20 |
| 2 | 3 | 2 | 20 |
| NULL | NULL | 10 | 10 |
+------+------+------+------+
5 rows in set (0.00 sec)