In the process of QA/QC, I am writing lots of queries with multiple joins. I am using MySQL.
I would like to know how (if) I can simplify join statements, e.g. by setting default fields to join on.
My tables are named with a plural form of the object that they contain:
names types actions surnames names_surnames
names_surnames is a many-many lookup table
the primary keys are always
id and the foreign keys are always, e.g.
names.type_id names.action_id names_surnames.name_id names_surnames.surname_id
My joins would be something like
select names.col1 from names join types on names.type_id = type.id join actions on names.action_id = actions.id;
Is there a way to get MySQL to always assume that tables will be joined with
on thistables.thattable_id = thattable.id?