DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   MySQL (http://www.daniweb.com/forums/forum126.html)
-   -   How To Create Foreign Key (http://www.daniweb.com/forums/thread33655.html)

jessica81 Oct 10th, 2005 4:42 am
How To Create Foreign Key
 
hi,im really new to MySQL,can some one help me in joining table pls...i hv 2 tables,customer table and record table

customer table with CustomerID,Customer Name,CustomerAddress,
record table with RecordID,CustomerID,Date,

how to make the CustomerID in record as foreign key? how to join that two tables so that record will be deleted when i delete the customer id? :sad:

i hope u guys could give me a hand :cry: thanks!

hemalatha.a.s Oct 12th, 2005 3:07 am
Re: How To Create Foreign Key
 
hai i am also new

PoA Oct 15th, 2005 8:05 am
Re: How To Create Foreign Key
 
Just to take note that there is no Foreign key in MySQL unless your database's type is InnoDB. I assume you are using MyISAM.

Quote:

DELETE FROM Customer WHERE CustomerID = yourcustomerid;
DELETE FROM Records WHERE CusomerID = yourcustomerid;


Hope it helps.


All times are GMT -4. The time now is 2:32 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC