I have a table named master_employee
with a column empid
as the primary key, and it has 12 rows in it. This empid
has been mapped as a foreign key to another table named dep_child
. I want to delete the 12 records in the master_employee
table but I was unable to do it.
You were unable to do the deletes from master_employees
, as there is a referential integrity with dep_child
. You would need to either disable the constraint or delete the records from dep_child
, before being able to delete records from master_employees
Add this constraints to your master_employee table
ALTER TABLE "master_employee"
ADD CONSTRAINT "fk_emp11"
FOREIGN KEY ("emp_id")
REFERENCES "dep_child" ("emp_id")
ON DELETE CASCADE;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.