Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 06-12-2004, 04:31 PM   #1
LQ Newbie
Registered: Aug 2003
Location: Pakistan
Posts: 29

Rep: Reputation: 15
Mysql Foreign Key

Hi readers,
I am new in mysql but i have all the conceptes of SQL.I am create the relation of primary key and foreign key in tables.The join is working but when i will delete a parent record it delete the parent record.
my requirement is it will give me the error like oracle ,when we have child record then we can not delete the parent records.and also when insertin data in child it inserted the date whetever the parent is exist or not.
My sql statments are

for parent tables

CREATE TABLE student(stu_id int(10)PRIMARY KEY,
stu_name VARCHAR(20) NOT NULL,
email varchar(30));
for child table

CREATE TABLE course (course_id int PRIMARY KEY,
course_name varchar(30)NOT NULL,
stu_id int(10),
REFERENCES student(stu_id));

Please help me urgent


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM
Bad Key / No Key Error MySql wasabi Linux - Software 1 04-19-2005 06:06 PM
Foreign languages floppywhopper LQ Suggestions & Feedback 24 01-07-2005 06:48 AM
MySQL Primairy Key problem agallant Programming 6 06-27-2004 11:12 PM
Foreign Charachters geekzen Linux - General 0 04-16-2004 04:26 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:16 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration