I completely understand the need to PKs and FKs but when using relational databases. But when using Mysql from the the terminal. what difference does it make adding PKs & FKs when you can you can join on a common column?
If I create the table
mysql> create table dudes (dude_id int, name varchar(30), age int);
mysql> create table pets (pet_id int, owner_id int, address varchar(30));
as opposed to doing this
mysql> create table dudes (dude_id int primary key, name varchar(30), age int);
mysql> create table pets (pet_id int primary key, owner_id int references(dude_id), address varchar(30));
I can still join each table correctly and do all that is needed. What else is MySQL doing in the background that makes my life easier by explicitly adding the PK and FK references?
SELECT *
From dudes d
JOIN pets p ON d.dude_id=p.own_id;