You are on page 1of 1

INSERT function in FOREIGN KEY

We need to insert two values in STUDENTS_C0912711 table and add same student_id
with courses table
values in COURSES_C091277.so, it inserted successfully, but we add new students_ID
in COURSES_C0912711
table we got integrity constraint violated error message.let see by writing code.
Database Design & SQL | Meet Chandrakantbhai Patel
Database Design & SQL | Meet Chandrakantbhai Patel
- So, we need to add new value first in parent table and then
add child table.
DELETE FUNCTION IN FOREIGN KEY
- When we need to delete record from parent table,so first we
have to remove record from child table and then we able to
delete from parent table.
- Let see by taking delete operation in students_c0912711
table.
Database Design & SQL | Meet Chandrakantbhai Patel

ASSUMPTION
- WE CAN ADD PRIMARY KEY, NOT NULL AND OTHER CONSTRAINTS USING ALTER TABLE, BUT
EVERY
TIME I CREATED NEW TABLE AS PER ASSIGNMENT NOTE.
THANK YOU !..

You might also like