CREATE TABLE [CMDB_ITEM_] (
    [CMDB_ITEM__ID] INT PRIMARY KEY,
    [BESCHRIJVING] NVARCHAR(MAX),
    [NAAM] VARCHAR(255)
);

CREATE TABLE [VERVOERSMIDDEL] (
    [CMDB_ITEM__ID] INT PRIMARY KEY
);

CREATE TABLE [LICENTIE] (
    [CMDB_ITEM__ID] INT PRIMARY KEY
);

CREATE TABLE [TOEGANGSMIDDEL] (
    [CMDB_ITEM__ID] INT PRIMARY KEY
);

CREATE TABLE [NERTWERKCOMPONENT] (
    [CMDB_ITEM__ID] INT PRIMARY KEY
);

CREATE TABLE [INVENTARIS] (
    [CMDB_ITEM__ID] INT PRIMARY KEY
);

CREATE TABLE [HARDWARE] (
    [CMDB_ITEM__ID] INT PRIMARY KEY
);

CREATE TABLE [SOFTWARE] (
    [CMDB_ITEM__ID] INT PRIMARY KEY
);

CREATE TABLE [KP_VRVRSMDDL_CMDB_ITM_] (
    [KP_VRVRSMDDL_CMDB_ITM__ID] INT PRIMARY KEY,
    [VERVOERSMIDDEL_ID] INT,
    [CMDB_ITEM__ID] INT
);

CREATE TABLE [KP_LCNT_CMDB_ITM_] (
    [KP_LCNT_CMDB_ITM__ID] INT PRIMARY KEY,
    [LICENTIE_ID] INT,
    [CMDB_ITEM__ID] INT
);

CREATE TABLE [KP_TGNGSMDDL_CMDB_ITM_] (
    [KP_TGNGSMDDL_CMDB_ITM__ID] INT PRIMARY KEY,
    [TOEGANGSMIDDEL_ID] INT,
    [CMDB_ITEM__ID] INT
);

CREATE TABLE [KP_NRTWRKCMPNNT_CMDB_ITM_] (
    [KP_NRTWRKCMPNNT_CMDB_ITM__ID] INT PRIMARY KEY,
    [NERTWERKCOMPONENT_ID] INT,
    [CMDB_ITEM__ID] INT
);

CREATE TABLE [KP_INVNTRS_CMDB_ITM_] (
    [KP_INVNTRS_CMDB_ITM__ID] INT PRIMARY KEY,
    [INVENTARIS_ID] INT,
    [CMDB_ITEM__ID] INT
);

CREATE TABLE [KP_HRDWR_CMDB_ITM_] (
    [KP_HRDWR_CMDB_ITM__ID] INT PRIMARY KEY,
    [HARDWARE_ID] INT,
    [CMDB_ITEM__ID] INT
);

CREATE TABLE [KP_SFTWR_CMDB_ITM_] (
    [KP_SFTWR_CMDB_ITM__ID] INT PRIMARY KEY,
    [SOFTWARE_ID] INT,
    [CMDB_ITEM__ID] INT
);

ALTER TABLE [HARDWARE] ADD CONSTRAINT FK_HARDWARE_GEN_CMDB_ITEM_ FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- Generalization to CMDB_ITEM_

ALTER TABLE [INVENTARIS] ADD CONSTRAINT FK_INVENTARIS_GEN_CMDB_ITEM_ FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- Generalization to CMDB_ITEM_

ALTER TABLE [LICENTIE] ADD CONSTRAINT FK_LICENTIE_GEN_CMDB_ITEM_ FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- Generalization to CMDB_ITEM_

ALTER TABLE [NERTWERKCOMPONENT] ADD CONSTRAINT FK_NERTWERKCOMPONENT_GEN_CMDB_ITEM_ FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- Generalization to CMDB_ITEM_

ALTER TABLE [SOFTWARE] ADD CONSTRAINT FK_SOFTWARE_GEN_CMDB_ITEM_ FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- Generalization to CMDB_ITEM_

ALTER TABLE [TOEGANGSMIDDEL] ADD CONSTRAINT FK_TOEGANGSMIDDEL_GEN_CMDB_ITEM_ FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- Generalization to CMDB_ITEM_

ALTER TABLE [VERVOERSMIDDEL] ADD CONSTRAINT FK_VERVOERSMIDDEL_GEN_CMDB_ITEM_ FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- Generalization to CMDB_ITEM_

ALTER TABLE [KP_VRVRSMDDL_CMDB_ITM_] ADD CONSTRAINT FK_KP_VRVRSMDDL_CMDB_ITM__1 FOREIGN KEY ([VERVOERSMIDDEL_ID]) REFERENCES [VERVOERSMIDDEL] ([CMDB_ITEM__ID]);
-- VERVOERSMIDDEL (many-to-many junction, Connector_ID: 609)

ALTER TABLE [KP_VRVRSMDDL_CMDB_ITM_] ADD CONSTRAINT FK_KP_VRVRSMDDL_CMDB_ITM__2 FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- CMDB_ITEM_ (many-to-many junction, Connector_ID: 609)

ALTER TABLE [KP_TGNGSMDDL_CMDB_ITM_] ADD CONSTRAINT FK_KP_TGNGSMDDL_CMDB_ITM__1 FOREIGN KEY ([TOEGANGSMIDDEL_ID]) REFERENCES [TOEGANGSMIDDEL] ([CMDB_ITEM__ID]);
-- TOEGANGSMIDDEL (many-to-many junction, Connector_ID: 610)

ALTER TABLE [KP_TGNGSMDDL_CMDB_ITM_] ADD CONSTRAINT FK_KP_TGNGSMDDL_CMDB_ITM__2 FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- CMDB_ITEM_ (many-to-many junction, Connector_ID: 610)

ALTER TABLE [KP_SFTWR_CMDB_ITM_] ADD CONSTRAINT FK_KP_SFTWR_CMDB_ITM__1 FOREIGN KEY ([SOFTWARE_ID]) REFERENCES [SOFTWARE] ([CMDB_ITEM__ID]);
-- SOFTWARE (many-to-many junction, Connector_ID: 611)

ALTER TABLE [KP_SFTWR_CMDB_ITM_] ADD CONSTRAINT FK_KP_SFTWR_CMDB_ITM__2 FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- CMDB_ITEM_ (many-to-many junction, Connector_ID: 611)

ALTER TABLE [KP_NRTWRKCMPNNT_CMDB_ITM_] ADD CONSTRAINT FK_KP_NRTWRKCMPNNT_CMDB_ITM__1 FOREIGN KEY ([NERTWERKCOMPONENT_ID]) REFERENCES [NERTWERKCOMPONENT] ([CMDB_ITEM__ID]);
-- NERTWERKCOMPONENT (many-to-many junction, Connector_ID: 619)

ALTER TABLE [KP_NRTWRKCMPNNT_CMDB_ITM_] ADD CONSTRAINT FK_KP_NRTWRKCMPNNT_CMDB_ITM__2 FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- CMDB_ITEM_ (many-to-many junction, Connector_ID: 619)

ALTER TABLE [KP_LCNT_CMDB_ITM_] ADD CONSTRAINT FK_KP_LCNT_CMDB_ITM__1 FOREIGN KEY ([LICENTIE_ID]) REFERENCES [LICENTIE] ([CMDB_ITEM__ID]);
-- LICENTIE (many-to-many junction, Connector_ID: 621)

ALTER TABLE [KP_LCNT_CMDB_ITM_] ADD CONSTRAINT FK_KP_LCNT_CMDB_ITM__2 FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- CMDB_ITEM_ (many-to-many junction, Connector_ID: 621)

ALTER TABLE [KP_INVNTRS_CMDB_ITM_] ADD CONSTRAINT FK_KP_INVNTRS_CMDB_ITM__1 FOREIGN KEY ([INVENTARIS_ID]) REFERENCES [INVENTARIS] ([CMDB_ITEM__ID]);
-- INVENTARIS (many-to-many junction, Connector_ID: 624)

ALTER TABLE [KP_INVNTRS_CMDB_ITM_] ADD CONSTRAINT FK_KP_INVNTRS_CMDB_ITM__2 FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- CMDB_ITEM_ (many-to-many junction, Connector_ID: 624)

ALTER TABLE [KP_HRDWR_CMDB_ITM_] ADD CONSTRAINT FK_KP_HRDWR_CMDB_ITM__1 FOREIGN KEY ([HARDWARE_ID]) REFERENCES [HARDWARE] ([CMDB_ITEM__ID]);
-- HARDWARE (many-to-many junction, Connector_ID: 625)

ALTER TABLE [KP_HRDWR_CMDB_ITM_] ADD CONSTRAINT FK_KP_HRDWR_CMDB_ITM__2 FOREIGN KEY ([CMDB_ITEM__ID]) REFERENCES [CMDB_ITEM_] ([CMDB_ITEM__ID]);
-- CMDB_ITEM_ (many-to-many junction, Connector_ID: 625)

