I'm trying to Delete all the records related to this supplier from all relevant tables for Supplier with supplierNum = S3.
But when I try to delete, I get an error
Can not delete or update a parent row
I already ready few topics here about it but could not figure out a solution. can somebody please help me out?
CREATE TABLE supplier
(
supplierNum CHAR(2) NOT NULL,
name CHAR(10) NOT NULL,
status TINYINT(4) NOT NULL,
city VARCHAR(10) NOT NULL,
PRIMARY KEY (supplierNum)
);
CREATE TABLE parts
(
partNum CHAR(2) NOT NULL,
name CHAR(10) NOT NULL,
colour CHAR(8) NOT NULL,
weight DECIMAL(3,1) NOT NULL,
city VARCHAR(10) NOT NULL,
PRIMARY KEY (partNum)
);
CREATE TABLE supplies
(
supplierNum CHAR(2) NOT NULL,
partNum CHAR(2) NOT NULL,
quantity SMALLINT(6) NOT NULL,
PRIMARY KEY (supplierNum, partNum),
FOREIGN KEY (supplierNum)
REFERENCES supplier (supplierNum),
FOREIGN KEY (partNum)
REFERENCES parts (partNum)
);