I do not understand how to use the foreign key, or if I am honest, what it can do.
I have been using Zoho which is all singing all dancing does it all for you and am trying to teach myself.
I have a table > Rescues .. which contains a column = name (varchar 200)
I have a table > Dogs in Need .. which contains a column = rescue (enum dropdown with plugin)
I want to link the 2 columns so that when I add a rescue into the rescue table, the name shows up in the dropdown list on the dogs in need table. Is this what a foreign key does and if so how do I do it?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I do not understand how to use the foreign key, or if I am honest, what it can do.
I have been using Zoho which is all singing all dancing does it all for you and am trying to teach myself.
I have a table > Rescues .. which contains a column = name (varchar 200)
I have a table > Dogs in Need .. which contains a column = rescue (enum dropdown with plugin)
I want to link the 2 columns so that when I add a rescue into the rescue table, the name shows up in the dropdown list on the dogs in need table. Is this what a foreign key does and if so how do I do it?
This question is not related to Admner.
You want this table structure:
rescue: id, name
dog_in_need: id, rescue_id, …
The dog_in_need.rescue_id is a foreign key to rescue.id.
With this table structure, any new rescue will show up in editing Dogs in Need in http://www.adminer.org/editor/.
Without using InnoDB tables but just MyISAM tables, where do the foreign key references go?
There's
foreignKeys
method that could be overridden.