Creating foreign keys
Posted by:
Fred Riley
Date: September 10, 2004 08:15AM
Ok, this has to be a FAQ, but there's no search on this newbie forum and I couldn't see anything in the first few pages of the forum, so here goes and await the flames.
The simple question I have is: how do I create a foreign key in a table, such that referential integrity is preserved on updates/deletes?
The follow-up question would be: how do I create an all-key junction table, containing only foreign keys?
I've already set up my main tables as InnoDB. I've hunted through the MySQL manual and just keep getting circular and unhelpful references to pages on foreign keys and CREATE TABLE. I've hunted using Google but haven't found anything helpful. I'm trying to use MySQLFront and MySQL CC to save typing shedloads of SQL queries (I'm not very experienced or expert in SQL), but documentation for those is either sparse or non-existent.
I've spent the last two hours trying to figure this out, and my head hurts. Although I'm no fan of Microsoft, I've got to say that setting up foreign keys and referential integrity in Access is pretty easy, so I'd hoped that MySQL wouldn't be much more difficult. I have a decent understanding of database design, and a basic knowledge of SQL mostly featuring SELECT statements and JOINs. Unfortunately I don't have the time right now to take a week out to learn MySQL from scratch, so I'm trying to produce an online database 'on the fly' in a short time.
Just some pointers would be handy and gratefully received.
Cheers
Fred
Subject
Written By
Posted
Creating foreign keys
September 10, 2004 08:15AM
September 10, 2004 11:37AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.