create table if not exists Klant (
  ID int unsigned not null auto_increment,
  Naam varchar(45) null,
  Postcode varchar(45) not null,
  Huisnummer int not null,
  Telefoonnummer int null,
  primary key (ID)
);

create table if not exists `Order` (
  ID int unsigned not null auto_increment,
  KlantID int unsigned not null,
  Besteldatum date not null,
  Status varchar(45) not null,
  primary key (ID),
  foreign key (KlantID) references Klant(ID)
);

create table if not exists Product (
  ID int unsigned not null auto_increment,
  Naam varchar(45) not null unique,
  Eenheid varchar(45) not null,
  Prijs FLOAT(24) not null,
  Beschrijving varchar(500) not null,
  primary key (ID)
);

create table if not exists OrderProduct (
  ID int unsigned not null auto_increment,
  OrderID int unsigned not null,
  ProductID int unsigned not null,
  Aantal int unsigned not null,
  primary key (ID),
  foreign key (OrderID) references `Order`(ID),
  foreign key (ProductID) references Product(ID),
  unique(OrderID, ProductID)
);

