Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relational tables

Status
Not open for further replies.
Mar 28, 2006
70
I come from a strong MSSQL background. I recently acquired a project that I need to do with MySQL. In MSSQL I was able to link the tables together, not allowing data to be deleted that was linked into another table. How can I force that type of realtionship on tables in MySQL?

Thanks!

~Matthew
 
Thanks for the help.

I switched over the tables to innodb. I set the tables up with Primary keys. However, I do not seem to find a foreign key option. (I am using phpmyadmin)

I did find a link that I think is where I need to be. "Relation View" puts me into something that looks like where I need to link table. However it is very poorly laid out and makes no sense what you are supposed to do. Each table has its own line, and give you link options. Very hard to understand what exactly you are linking. Any online documentation how to use that thing??

Thanks again!
 
sorry, i don't do phpmyadmin

but you can always declare exactly what you want with sql (i.e. in phpmyadmin's sql window)

ALTER TABLE childtable
ADD INDEX fk_index (fkey)
;
ALTER TABLE childtable
ADD FOREIGN KEY (fkey) REFERENCES parenttable (pkey)
;

r937.com | rudy.ca
 
Ahh, now I see. I ran this SQL statement and watched what it did in phpmyadmin. Now I see how it works. PHPMyAdmin is poorly documented in that area, they way it is laid out is very porrly designed.

Thanks again for the help!!

~Matthew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top