Hi I've searched the web and this site for the answer I'm looking for but the answers aren't helping me in my case.
I'm making a database for a shop that has multiple locations. Everything worked until I normalized the database. As you can see here:
create table Locatie (
locatie integer,
adres varchar (70),
plaats varchar (70) not null,
constraint pk_locatie primary key (locatie)); go
create table Voorraad (
artikelnr integer,
voorraadid integer,
aantal integer not null,
locatie integer not null,
constraint pk_artikelnr_aantal primary key (artikelnr, aantal),
constraint fk_Artikel_Voorraad foreign key (artikelnr) references Artikel (artikelnr),
constraint fk_Locatie_Voorraad foreign key (voorraadid) references Locatie (locatie),
constraint uq_voorraadid_locatie unique (voorraadid, locatie)); go
these are ofcourse my parrent tables. But I get the error in the child one:
create table Artikelvoorraad (
artikelnr integer,
voorraadid integer,
aantal integer not null,
constraint pk_artikelnr_voorraadid primary key (artikelnr, voorraadid),
constraint fk_Artikel_Artikelvoorraad foreign key (artikelnr)
references Artikel (artikelnr),
constraint fk_Voorraad_Artikelvoorraad foreign key (voorraadid)
references Voorraad (voorraadid, locatie)); go
Is there someone who can point me in the right direction?
Thanks for reading this far!