> Unless your schema is really fucked up, there should only be one or two actually sensible ways to join across multiple tables. Like say I have apples in boxes in houses. I have an apple table, a box table, and a house table. apples have a box_id, boxes have a house_id. Now I want to find all the apples in a house. Do two joins, cool. But literally everyone seems to write this by hand, and it means that crud apps end up with thousands of nearly identical queries which are mostly just boringly spelling out the chain of joins that needs to be applied.
You are primarily describing natural join here. It won’t read your mind and join your tables automatically, but it automatically uses shared columns as join keys and removes the duplicate keys from the result.
The problem with any “auto” solution is going to be things like modified dates, which may exist in multiple tables but aren’t shared.
Even more magic is natural semi join and natural anti join.
You are primarily describing natural join here. It won’t read your mind and join your tables automatically, but it automatically uses shared columns as join keys and removes the duplicate keys from the result.
The problem with any “auto” solution is going to be things like modified dates, which may exist in multiple tables but aren’t shared.
Even more magic is natural semi join and natural anti join.