0

I am using Oracale SQL Developer, and I am wondering when I insert data into a table, will the data cascade to another table that has the first tables primary key as a foreign key for example if I run

insert into DEPARTMENT values ('1', 'Karate');

Will the first value in Column 'DEPARTMENTID' also be inserted into the other table I.E 'TEACHER' or do I have to manually insert the value into the both tables.

Thanks

3
  • no, you cannot have one insert add data to two tables. it's not insert into foo,bar values ..., after all. Commented Sep 17, 2015 at 16:25
  • Thank you for clearing this up! I just thought that it would cascade maybe :S Commented Sep 17, 2015 at 16:25
  • If there were more required (not null) information in the teacher table, how could it get it? Always need to create the parent before the child when foreign keys are involved. Commented Sep 17, 2015 at 16:27

1 Answer 1

2

No, inserts will not cascade. You'll have to insert data in parent table and then in child tables.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much for clearing this up! I will mark the answer as correct

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.