My table:
abc
+--------+
| letter |
+--------+
| a |
| b |
+--------+
Query:
SELECT *
FROM abc t1 INNER JOIN abc t2
ON true
Result:
+--------+--------+
| letter | letter |
+--------+--------+
| a | a |
| b | a |
| a | b |
| b | b |
+--------+--------+
What does or how does ON true do/work?
While I've never seen this exact syntax (for obvious reasons - it really serves little purpose and I wouldn't expect to encounter it in the real world) my guess would be that the result will be a cartesian product as the condition states that rows in t1 should be matched with rows in t2 when condition evaluates as true, which it always does. So all rows in the first set will be matched to all rows in the second set.
The condition is never tried against anything else, just itself and true will always evaluate as true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With