CREATE TABLE `WERKNEMER` (
    `WERKNEMER_ID` INT PRIMARY KEY,
    `GEBOORTEDATUM` DATE,
    `NAAM` VARCHAR(80),
    `VOORNAAM` VARCHAR(255),
    `WOONPLAATS` VARCHAR(50)
) ENGINE=InnoDB;

CREATE TABLE `DOCUMENT` (
    `DOCUMENT_ID` INT PRIMARY KEY,
    `COCUMENTBESCHRIJVING` VARCHAR(255),
    `DATUMCREATIEDOCUMENT` DATE,
    `DATUMONTVANGSTDOCUMENT` DATE,
    `DATUMVERZENDINGDOCUMENT` DATE,
    `DOCUMENTAUTEUR` VARCHAR(200),
    `DOCUMENTIDENTIFICATIE` VARCHAR(255),
    `DOCUMENTTITEL` VARCHAR(200),
    `VERTROUWELIJKAANDUIDING` VARCHAR(20)
) ENGINE=InnoDB;

CREATE TABLE `BEOORDELING` (
    `BEOORDELING_ID` INT PRIMARY KEY,
    `BEOORDEELD_DOOR_WERKNEMER_ID` INT,
    `BEOORDELING_VAN_WERKNEMER_ID` INT,
    `DATUM` DATE,
    `OMSCHRIJVING` TEXT,
    `OORDEEL` VARCHAR(80)
) ENGINE=InnoDB;

CREATE TABLE `DIENSTVERBAND` (
    `DIENSTVERBAND_ID` INT PRIMARY KEY,
    `DATUMEINDE` DATE,
    `DATUMSTART` DATE,
    `MEDEWERKER_HEEFT_DIENSTVERBAND_WERKNEMER_ID` INT,
    `PERIODIEK` INT,
    `SALARIS` VARCHAR(255),
    `SCHAAL` INT,
    `URENPERWEEK` INT
) ENGINE=InnoDB;

CREATE TABLE `KP_WRKNMR_DCMNT` (
    `KP_WRKNMR_DCMNT_ID` INT PRIMARY KEY,
    `WERKNEMER_ID` INT,
    `DOCUMENT_ID` INT
) ENGINE=InnoDB;

CREATE TABLE `KP_BRDLNG_DCMNT` (
    `KP_BRDLNG_DCMNT_ID` INT PRIMARY KEY,
    `BEOORDELING_ID` INT,
    `DOCUMENT_ID` INT
) ENGINE=InnoDB;

CREATE TABLE `KP_DNSTVRBND_DCMNT` (
    `KP_DNSTVRBND_DCMNT_ID` INT PRIMARY KEY,
    `DIENSTVERBAND_ID` INT,
    `DOCUMENT_ID` INT
) ENGINE=InnoDB;

ALTER TABLE `KP_WRKNMR_DCMNT` ADD CONSTRAINT FK_KP_WRKNMR_DCMNT_1 FOREIGN KEY (`WERKNEMER_ID`) REFERENCES `WERKNEMER` (`WERKNEMER_ID`);
-- WERKNEMER (many-to-many junction, Connector_ID: 107)

ALTER TABLE `KP_WRKNMR_DCMNT` ADD CONSTRAINT FK_KP_WRKNMR_DCMNT_2 FOREIGN KEY (`DOCUMENT_ID`) REFERENCES `DOCUMENT` (`DOCUMENT_ID`);
-- DOCUMENT (many-to-many junction, Connector_ID: 107)

ALTER TABLE `KP_DNSTVRBND_DCMNT` ADD CONSTRAINT FK_KP_DNSTVRBND_DCMNT_1 FOREIGN KEY (`DIENSTVERBAND_ID`) REFERENCES `DIENSTVERBAND` (`DIENSTVERBAND_ID`);
-- DIENSTVERBAND (many-to-many junction, Connector_ID: 109)

ALTER TABLE `KP_DNSTVRBND_DCMNT` ADD CONSTRAINT FK_KP_DNSTVRBND_DCMNT_2 FOREIGN KEY (`DOCUMENT_ID`) REFERENCES `DOCUMENT` (`DOCUMENT_ID`);
-- DOCUMENT (many-to-many junction, Connector_ID: 109)

ALTER TABLE `KP_BRDLNG_DCMNT` ADD CONSTRAINT FK_KP_BRDLNG_DCMNT_1 FOREIGN KEY (`BEOORDELING_ID`) REFERENCES `BEOORDELING` (`BEOORDELING_ID`);
-- BEOORDELING (many-to-many junction, Connector_ID: 110)

ALTER TABLE `KP_BRDLNG_DCMNT` ADD CONSTRAINT FK_KP_BRDLNG_DCMNT_2 FOREIGN KEY (`DOCUMENT_ID`) REFERENCES `DOCUMENT` (`DOCUMENT_ID`);
-- DOCUMENT (many-to-many junction, Connector_ID: 110)

ALTER TABLE `DIENSTVERBAND` ADD CONSTRAINT FK_DIENSTVERBAND_MEDEWERKER_HEEFT_DIENSTVERBAND FOREIGN KEY (`MEDEWERKER_HEEFT_DIENSTVERBAND_WERKNEMER_ID`) REFERENCES `WERKNEMER` (`WERKNEMER_ID`);
-- MEDEWERKER_HEEFT_DIENSTVERBAND (1 to 1..*, Connector_ID: 468)

ALTER TABLE `BEOORDELING` ADD CONSTRAINT FK_BEOORDELING_BEOORDELING_VAN FOREIGN KEY (`BEOORDELING_VAN_WERKNEMER_ID`) REFERENCES `WERKNEMER` (`WERKNEMER_ID`);
-- BEOORDELING_VAN (1 to 0..*, Connector_ID: 475)

ALTER TABLE `BEOORDELING` ADD CONSTRAINT FK_BEOORDELING_BEOORDEELD_DOOR FOREIGN KEY (`BEOORDEELD_DOOR_WERKNEMER_ID`) REFERENCES `WERKNEMER` (`WERKNEMER_ID`);
-- BEOORDEELD_DOOR (1 to 0..*, Connector_ID: 476)

