Error deleting record: Cannot delete or update a parent row: a foreign key constraint fails (`cs230_u200286`.`UserAddress`, CONSTRAINT `UserIDFK` FOREIGN KEY (`UserID`) REFERENCES `USERS` (`UserID`)) code example
Example 1: error 1451 (23000): cannot delete or update a parent row: a foreign key constraint fails
SET FOREIGN_KEY_CHECKS = 0;
SET FOREIGN_KEY_CHECKS = 1;
Example 2: Cannot delete or update a parent row: a foreign key constraint fails (
ALTER TABLE "appointments" DROP FOREIGN KEY "appointments_user_id_foreign";
ALTER TABLE "appointments" ADD CONSTRAINT "appointments_user_id_foreign" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE;