I've built my first ever simple MySQL DB with the myPhpAdmin interface.
1st users table: id (PK), email, fname, lname, isConsultant [bool]...
2nd consultants table: id (PK), title, bio...
3rd table linking both (some users are consultants, some are not): id (PK), user_id (FK), consultant_id (FK).
I have Primary Key and Foreign Key well assigned (I've followed quite a few video tutorials).
Now when I test and try to insert values into my 3rd table, I see "duplicate" options offered to me by the myPhpAdmin interface:
What did I do wrong? Please if you could use simple wordings since I'm new to this!?
phpMyAdmin shows these foreign key relations sorted both ways — by the key and by the referenced name. That makes it easy for you to insert data regardless of whether you know the id is 1 or the corresponding value is Law.
You haven't done anything wrong, and it's a little confusing at first, but this is working exactly as intended. You can use either from the dropdown to pick the same value; it will insert the '1' regardless of whether you select "1 - Law" or "Law - 1".
Thank you tons Isaac for giving this much needed answer, which even the guys at MySQL forum ('newbie' section) could not even answer properly. You're the best!
I'm delighted to be able to help you. Thanks for the kind words. Cheers!