Aturan kunci asing Anda adalah ON DELETE SET NULL
tetapi definisi kolom Anda adalah NOT NULL
.
Ubah definisi kolom Anda dan hapus NOT NULL
sebagian atau terlalu memikirkan aturan kunci asing Anda. Itu berhasil:
CREATE TABLE Vineyard (
VineyardID smallint auto_increment,
VineyardName VARCHAR(45) NOT NULL,
FarmerID smallint,
GrapeID smallint,
ComeFrom varchar(45) NOT NULL,
HarvestedAmount int,
RipenessPercent int,
PRIMARY KEY (VineyardID),
FOREIGN KEY (FarmerID) REFERENCES Worker(WorkerID)
ON DELETE SET NULL
ON UPDATE CASCADE,
FOREIGN KEY (GrapeID) REFERENCES Grape(GrapeID)
ON DELETE SET NULL
ON UPDATE CASCADE
)Engine=InnoDB;