User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 391,592 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,717 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 10540 | Replies: 2
Reply
Join Date: Oct 2005
Posts: 1
Reputation: jessica81 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jessica81 jessica81 is offline Offline
Newbie Poster

How To Create Foreign Key

  #1  
Oct 10th, 2005
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?

i hope u guys could give me a hand :cry: thanks!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2005
Posts: 3
Reputation: hemalatha.a.s is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
hemalatha.a.s hemalatha.a.s is offline Offline
Newbie Poster

Re: How To Create Foreign Key

  #2  
Oct 12th, 2005
hai i am also new
Reply With Quote  
Join Date: Jul 2004
Posts: 191
Reputation: PoA is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
PoA PoA is offline Offline
Junior Poster

Re: How To Create Foreign Key

  #3  
Oct 15th, 2005
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.

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

Hope it helps.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MySQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 11:26 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC