Fremmednøgle
Hej,jeg kan ikke helt forstå hvorfor denne kode ikke virker:
CREATE TABLE `City` (
`zipCode` INTEGER(4) NOT NULL,
`cityName` VARCHAR(50) NOT NULL
);
CREATE TABLE `Members` (
`memberID` INTEGER AUTO_INCREMENT,
`firstName` VARCHAR(30) NOT NULL,
`lastName` VARCHAR(30) NOT NULL,
`streetName` VARCHAR(50) NOT NULL,
`phoneNumber` INT(8) NOT NULL,
`hasCertificate` BOOLEAN NOT NULL,
`birthday` DATE NOT NULL,
`signUpDate` DATE NOT NULL,
`seniority` DATE NOT NULL,
`password` VARCHAR(50) NOT NULL,
`deleted` BOOLEAN NOT NULL,
`FK_zipCode` INTEGER(4) NOT NULL,
PRIMARY KEY (`memberID`),
FOREIGN KEY (`FK_zipCode`) REFERENCES `City` (`zipCode`)
ON DELETE CASCADE ON UPDATE CASCADE
);
Er der nogen der har et bud?
Tak!