It seems strange to me that, when I've defined a foreign key, the engine cannot use this information to automatically figure out the correct JOIN expressions, but instead requires me to re-type the same clauses. Are there any databases, perhaps some kind of research project, that will inspect the existing foreign keys?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
I'm not aware of any that use foreign keys (and that would can be messy if you have more than one foreign key back to the same table)
It would be really cool if I could write this
and the dbms would know that it needs to evaluate this.
Really cool. But not every join is an equi-join.
If you find yourself writing the same join clauses over and over, maybe you just need more views.
There are auto-complete utils for your editor of choice to auto-suggest appropriate join statements if typing is the concern. RedGate's SQL Prompt for handling SQL Server in SSMS & Visual Studio. I believe Quest's TOAD will handle Oracle and some of the other more popular RDMSs.