From 15d5cc48c564d0b4be0e84c9313ab00d1aee0a9b Mon Sep 17 00:00:00 2001
From: Patrick Keist
Date: Tue, 6 Aug 2019 14:38:31 +0200
Subject: [PATCH] Some Changes in Table Customers for RegEx-Testat
---
MySQL/Skript_DDL.sql | 21 +++++++++++----------
MySQL/Skript_DML.sql | 32 +++++++++++++-------------------
2 files changed, 24 insertions(+), 29 deletions(-)
diff --git a/MySQL/Skript_DDL.sql b/MySQL/Skript_DDL.sql
index a2d3b2b..2641cb3 100644
--- a/MySQL/Skript_DDL.sql
+++ b/MySQL/Skript_DDL.sql
@@ -30,14 +30,15 @@ CREATE Table IF NOT EXISTS Kundenkonto (
kundenkonto_id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT);
CREATE Table IF NOT EXISTS Customer (
-person_fk INT UNSIGNED NOT NULL,
-address_fk INT UNSIGNED NOT NULL,
+customer_id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+firstname VARCHAR(45) NOT NULL,
+lastname VARCHAR(45) NOT NULL,
+addressnumber VARCHAR(45) NOT NULL,
kundenkonto_fk INT UNSIGNED NOT NULL,
tel VARCHAR(20),
-eMail VARCHAR(30),
-url VARCHAR(30),
-FOREIGN KEY (person_fk) REFERENCES Person(Person_id) ON DELETE CASCADE,
-FOREIGN KEY (address_fk) REFERENCES Address(address_id) ON DELETE CASCADE,
+eMail VARCHAR(70),
+url VARCHAR(70),
+`password` VARCHAR(255),
FOREIGN KEY (kundenkonto_fk) REFERENCES Kundenkonto(kundenkonto_id) ON DELETE CASCADE);
CREATE TABLE IF NOT EXISTS Location (
@@ -59,15 +60,15 @@ FOREIGN KEY (person_fk) REFERENCES Person(person_id)ON DELETE CASCADE
CREATE TABLE IF NOT EXISTS PointOfDelivery (
pod_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
-customer_person_fk INT UNSIGNED NOT NULL,
-contact_person_fk INT UNSIGNED NOT NULL,
+customer_id_fk INT UNSIGNED NOT NULL,
+contact_id_fk INT UNSIGNED NOT NULL,
location_fk INT UNSIGNED NOT NULL,
designation VARCHAR(45),
timezone TIME NOT NULL,
timeZonePositiv TINYINT NOT NULL,
ntpServerIp VARCHAR(20),
-FOREIGN KEY (`customer_person_fk`) REFERENCES `customer`(`person_fk`)ON DELETE CASCADE,
-FOREIGN KEY (`contact_person_fk`) REFERENCES `contact`(`contact_id`)ON DELETE CASCADE,
+FOREIGN KEY (`customer_id_fk`) REFERENCES `customer`(`customer_id`)ON DELETE CASCADE,
+FOREIGN KEY (`contact_id_fk`) REFERENCES `contact`(`contact_id`)ON DELETE CASCADE,
FOREIGN KEY (`location_fk`) REFERENCES `location`(`location_id`) ON DELETE CASCADE
);
diff --git a/MySQL/Skript_DML.sql b/MySQL/Skript_DML.sql
index 2dc9a5e..673d3d9 100644
--- a/MySQL/Skript_DML.sql
+++ b/MySQL/Skript_DML.sql
@@ -32,12 +32,12 @@ INSERT INTO kundenkonto(kundenkonto_id)
VALUES
(1),(2),(3),(4),(5),(6),(7),(8);
-INSERT INTO customer(person_fk, address_fk, kundenkonto_fk, tel, eMail, url)
+INSERT INTO customer(firstname, lastname, addressnumber, kundenkonto_fk, tel, eMail, url)
VALUES
-(1, 2, 3, '079 666 20 14', 'nina.schmid@test.ch','www.nina.ch'),
-(2, 1, 1, 'Dose mit Schnur', 'bilbo@auenland.xx',null),
-(3, 3, 2, '078 878 90 43', 'p.keist@hotmail.com',null),
-(6, 4, 4, '077 777 77 77', 'ronny@wyss.ch',null);
+('Nina','Schmid', 2, 3, '079 666 20 14', 'nina.schmid@test.ch','www.nina.ch'),
+('Bilbo','Beutlin', 1, 1, 'Dose mit Schnur', 'bilbo@auenland.xx','https://de.wikipedia.org/wiki/Auenland'),
+('Max','Muster', 3, 2, '078 878 90 43', 'test@test.ch', null),
+('Patrick','Keist', 4, 4, '077 777 77 77', 'p.keist@hotmail.com','https://www.keist.com');
INSERT INTO contact( person_fk, priority)
VALUES
@@ -49,22 +49,16 @@ VALUES
INSERT INTO location( parent_location, address_fk, designation, building, room)
VALUES
-(null, 1, 'Vertriebszentrum Tabak', 2, 4),
-(1, 2, 'Logistik', 2, 5),
-(1, 3, 'Administration',1,9),
-(1, 4, 'Buchhaltung', 1,8),
-(2, 2, 'Logistik_Büro1', 2,5),
-(2, 2, 'Logistik_Büro2', 2,6),
-(2, 2, 'Logistik_Büro3', 2,7),
-(3, 3, 'Administration_Büro1', 1,1),
-(3, 3, 'Administration_Büro2', 1,2),
-(3, 3, 'Administration_Büro3', 1,3),
-(4, 4, 'Buchhaltung_Büro1', 1,1),
-(4, 4, 'Buchhaltung_Büro1', 1,1)
-;
+(0, 1, 'Vertriebszentrum Tabak', 2, 4),
+(1, 1, 'Logistik', 2, 5),
+(2, 2, 'Buchhaltung2', 1,8),
+(1, 2, 'Administration',1,9),
+(1, 2, 'Buchhaltung1', 1,8),
+(2, 2, 'Buchhaltung3', 1,8),
+(6, 2, 'Buchhaltung4', 1,8);
-INSERT INTO pointofdelivery(customer_person_fk, contact_person_fk, location_fk, designation, timezone, timeZonePositiv, ntpServerIp)
+INSERT INTO pointofdelivery(customer_id_fk, contact_id_fk, location_fk, designation, timezone, timeZonePositiv, ntpServerIp)
VALUES
(2,2,1,'Auenland','10:00:00',1, '1.1.1.10'),
(1,1,3, 'Consult & Pepper Trogen', '01:00:00', 1 , '178.198.222.68'),