Mysql Foreign Key
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,
for child table
CREATE TABLE course (course_id int PRIMARY KEY,
course_name varchar(30)NOT NULL,
Please help me urgent
|All times are GMT -5. The time now is 08:43 PM.|