aboutsummaryrefslogtreecommitdiff
path: root/opdracht-1/q2.sql
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-09-29 14:36:40 +0200
committerlonkaars <loek@pipeframe.xyz>2022-09-29 14:36:40 +0200
commit8510d3aec5fb5e5ff4f7a37f2450c9a250745043 (patch)
tree80584164167f2cf3a6386e161012019f64621fc6 /opdracht-1/q2.sql
parent4e1edb93cc47a616b89fa5188eb444eb665e0160 (diff)
beginsels opdracht 1
Diffstat (limited to 'opdracht-1/q2.sql')
-rw-r--r--opdracht-1/q2.sql38
1 files changed, 38 insertions, 0 deletions
diff --git a/opdracht-1/q2.sql b/opdracht-1/q2.sql
new file mode 100644
index 0000000..fda5f53
--- /dev/null
+++ b/opdracht-1/q2.sql
@@ -0,0 +1,38 @@
+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)
+);
+