diff --git a/ERD_lab.mwb b/ERD_lab.mwb new file mode 100644 index 0000000..3334d56 Binary files /dev/null and b/ERD_lab.mwb differ diff --git a/ERD_lab.mwb.bak b/ERD_lab.mwb.bak new file mode 100644 index 0000000..b6e7c4d Binary files /dev/null and b/ERD_lab.mwb.bak differ diff --git a/create.sql b/create.sql new file mode 100644 index 0000000..c2af9af --- /dev/null +++ b/create.sql @@ -0,0 +1,44 @@ +drop table if exists cars; + +create table cars ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +vin VARCHAR(50) NOT NULL, +manufacturer VARCHAR(50) NOT NULL, +model VARCHAR(50) NOT NULL, +year INT NOT NULL, +color VARCHAR(50) NOT NULL +); + + +drop table if exists customers; + +create table customers ( +customer_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +Name varchar(50) NOT NULL, +Phone_nr int NOT NULL, +Email VARCHAR(50) NOT NULL, +Address varchar(50) not null, +City VARCHAR(50) NOT NULL, +State varchar(50), +Country varchar(50), +Zipcode varchar(20) +); + + +drop table if exists invoices; + +create table invoices ( +invoice_nr int primary key not null, +date date not null, +VIN varchar(50) not null, +customer_ID int not null, +staff_Id int not null); + + +drop table if exists salesperson; + +create table salesperson ( +staff_ID int not null primary key, +Name varchar(30), +Store varchar(30) +); diff --git a/delete.sql b/delete.sql new file mode 100644 index 0000000..3f06690 --- /dev/null +++ b/delete.sql @@ -0,0 +1,2 @@ +delete from cars +where VIN = 'DAM41UDN3CHU2WVF6'; \ No newline at end of file diff --git a/seeding.sql b/seeding.sql new file mode 100644 index 0000000..0cda6cc --- /dev/null +++ b/seeding.sql @@ -0,0 +1,31 @@ +INSERT INTO `lab_mysql`.`cars` (`VIN`,`manufacturer`,`model`,`year`,`color`) +VALUES ('3K096I98581DHSNUP', 'Volkswagen', 'Tiguan', 2019, 'Blue'), +('ZM8G7BEUQZ97IH46V', 'Peugeot', 'Rifter', 2019, 'Red'), +('RKXVNNIHLVVZOUB4M', 'Ford', 'Fusion', 2018, 'White'), +('HKNDGS7CU31E9Z7JW', 'Toyota', 'RAV4', 2018, 'Silver'), +('DAM41UDN3CHU2WVF6', 'Volvo', 'V60', 2019, 'Gray'); + +INSERT INTO `lab_mysql`.`customers` (`customer_ID`,`Name`,`Phone_nr`,`Email`,`Address`,`City`,`State`,`Country`,`Zipcode`) +VALUES +(10001, 'Pablo Picasso', '+34636176382', 'ppicasso@gmail.com', 'Paseo de la Chopera, 14', 'Madrid', 'Madrid', 'Spain', 28045), +(20001, 'Abraham Lincoln', '+13059077086', 'lincoln@us.gov', '120 SW 8th St', 'Miami', 'Florida', 'United States', 33130), +(30001, 'Napoléon Bonaparte', '+33179754000', 'hello@napoleon.me', '40 Rue du Colisée', 'Paris', 'Île-de-France', 'France', 75008); + + +INSERT INTO `lab_mysql`.`salesperson` (`staff_ID`,`Name`,`Store`) +VALUES +(1, 'Petey Cruiser', 'Madrid'), +(2, 'Anna Sthesia', 'Barcelona'), +(3, 'Paul Molive', 'Berlin'), +(4, 'Gail Forcewind', 'Paris'), +(5, 'Paige Turner', 'Mimia'), +(6, 'Bob Frapples', 'Mexico City'), +(7, 'Walter Melon', 'Amsterdam'), +(8, 'Shonda Leer', 'São Paulo'); + + +INSERT INTO invoices (invoice_nr, date, VIN, customer_ID, staff_ID) +VALUES (852399038, 2018-08-22,'3K096I98581DHSNUP', 10001, 00003), +(731166526, 2018-12-31, 'RKXVNNIHLVVZOUB4M', 30001, 00005), +(271135104, 2019-01-22, 'ZM8G7BEUQZ97IH46V', 20001, 00007); + diff --git a/update.sql b/update.sql new file mode 100644 index 0000000..baae21f --- /dev/null +++ b/update.sql @@ -0,0 +1,11 @@ +update customers +set Email = 'ppicasso@gmail.com' +where Name = 'Pablo Picasso'; + +update customers +set Email = 'lincoln@us.gov' +where Name = 'Abraham Lincoln'; + +update customers +set Email = 'hello@napoleon.me' +where Name = 'Napoléon Bonaparte';