# Self Join
__*CONCAT function*__
__*Cartesian Product*__
+ The ratio analysis of Mars to Earth
```
tidb> SELECT concat(p1.name, concat('/',p2.name)) as 'Mars-Earth',
    -> p1.diameter/p2.diameter as Diameter,
    -> p1.mass/p2.mass as Mass,
    -> p1.gravity/p2.gravity as Gravity,
    -> p1.density/p2.density as Density,
    -> p1.escape_velocity/p2.escape_velocity as 'Escape Velocity'
    -> FROM ~!@planets p1@!~
    -> JOIN ~!@planets p2@!~
    -> WHERE p1.name = 'Mars'
    -> AND p2.name = 'Earth'\G
*************************** 1. row***************************
     Mars-Earth: Mars/Earth
       Diameter: 0.532455
           Mass: 0.10753769549625292
        Gravity: 0.37755
        Density: 0.7135
Escape Velocity: 0.44643
1 row in set (0.00 sec)
```

------------------------------------------------------------
Observing the execution plan, you will see that this is a Cartesian product operation.
```
tidb> EXPLAIN SELECT concat(p1.name, concat('/',p2.name)) as 'Mars-Earth',
    -> p1.diameter/p2.diameter as Diameter,
    -> p1.mass/p2.mass as Mass,
    -> p1.gravity/p2.gravity as Gravity,
    -> p1.density/p2.density as Density,
    -> p1.escape_velocity/p2.escape_velocity as 'Escape Velocity'
    -> FROM planets p1
    -> JOIN planets p2
    -> WHERE p1.name = 'Mars'
    -> AND p2.name = 'Earth';
```
