A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

On which table should the foreign key be defined?

For simple relational databases the foreign key is usually defined on one table only:
  • For join tables (linking tables), put the foreign keys on the join table itself.
  • For lookup tables, don't put the foreign key on them, put it on the other (main) table.