This way we could still do:
1<->M
M<->M
1<->1
No more handeling of IDs and if you don't want the DB to do the "implicit join" just omit the column.
Would we loose any kind of flexibility?
I strongly suspect that I am missing something here but I don't know how to find information / search for it.
This is typed in the foreign key constraints DDL.<p>Often a foreign key will refer to rows in more than one other table. Not all queries will want to chase all of those references.<p>Moreover, when you have a composite key, the foreign part may only be a subset of the entire key.<p>For example, if your Key is {Street,House}, you have a relation to another table which has a list of people inside that {Street,House} and you might also have a relation on {Street} to a table that contains metadata about that street as a whole.<p>The "Type" of the "row in another table" isn't a single thing: it would be different for all the different relations so it exists in the form of foreign key declarations which embody all the variability in the relation.
As andyjpb said, it's encoded in the foreign key.<p>Many ORMs have capabilities for "implicit joins" with either lazy or eager loading of the foreign rows, for example the latest Entity Framework from Microsoft.<p><a href="http://msdn.microsoft.com/en-us/data/jj713564.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/data/jj713564.aspx</a><p>If you like that kind of "automagic" things, check out Genexus:<p><a href="http://www.genexus.com/global/home?en" rel="nofollow">http://www.genexus.com/global/home?en</a><p>it's a 4GL programming environment that has as one of its main strengths that kind of implicit joins and automatic retrieval of data you mention, as long as you follow the naming conventions.<p>It's a REALLY fast way to build your standard line-of-business application (and it automatically generates iOS and Android apps too), but it falls apart for any other use, and it's UI is not that flexible usually.