diff --git a/your-code/DB_Design_page-0001.jpg b/your-code/DB_Design_page-0001.jpg new file mode 100644 index 0000000..0249fd9 Binary files /dev/null and b/your-code/DB_Design_page-0001.jpg differ diff --git a/your-code/create.sql b/your-code/create.sql index e69de29..18394da 100644 --- a/your-code/create.sql +++ b/your-code/create.sql @@ -0,0 +1,36 @@ +CREATE DATABASE IF NOT EXISTS lab_mysql; +USE lab_mysql; + + CREATE TABLE IF NOT EXISTS lab_mysql.cars (id INT PRIMARY KEY, + VIN VARCHAR (52), + Manufacturer VARCHAR (52), + Model VARCHAR (52), + Car_year INT NOT NULL, + Color VARCHAR (52) + ); + + CREATE TABLE IF NOT EXISTS lab_mysql.costumers (id INT PRIMARY KEY, + Customer_ID INT NOT NULL, + Customer_Name VARCHAR (52), + Phone VARCHAR (52), + Email VARCHAR (52) DEFAULT 'jonhdoe@gmail.com', + Address VARCHAR (52), + City VARCHAR (52), + State_Province VARCHAR (52), + Country VARCHAR (52), + Postal INT NOT NULL + ); + +CREATE TABLE IF NOT EXISTS lab_mysql.salespersons (ID INT PRIMARY KEY, + Staff_ID INT NOT NULL, + Name VARCHAR (52), + Store VARCHAR (52) + ); + +CREATE TABLE IF NOT EXISTS lab_mysql.invoices (ID INT PRIMARY KEY, + Invoice_Number INT NOT NULL, + Date DATE, + Car INT, + Customer INT, + Sales_Person INT + ); \ No newline at end of file diff --git a/your-code/delete.sql b/your-code/delete.sql index e69de29..bf8e320 100644 --- a/your-code/delete.sql +++ b/your-code/delete.sql @@ -0,0 +1,4 @@ +DELETE FROM cars +WHERE id = 4; + +SELECT * FROM cars; \ No newline at end of file diff --git a/your-code/seeding.sql b/your-code/seeding.sql index e69de29..0005b89 100644 --- a/your-code/seeding.sql +++ b/your-code/seeding.sql @@ -0,0 +1,40 @@ +INSERT INTO lab_mysql.cars(id, VIN, Manufacturer, Model, Car_year, Color) +VALUES(0, '3K096I98581DHSNUP', 'Volkswagen', 'Tiguan', 2019, 'Blue'), + (1, 'ZM8G7BEUQZ97IH46V', 'Peugeot', 'Rifter', 2019, 'Red'), + (2, 'RKXVNNIHLVVZOUB4M', 'Ford', 'Fusion', 2018, 'White'), + (3, 'HKNDGS7CU31E9Z7JW', 'Toyota', 'RAV4', '2018', 'Silver'), + (4, 'DAM41UDN3CHU2WVF6', 'Volvo', 'V60', 2019, 'Gray'), + (5, 'DAM41UDN3CHU2WVF6', 'Volvo', 'V60 Cross Country', 2019, 'Gray'); + +INSERT INTO lab_mysql.costumers(id, Customer_ID, Customer_Name, Phone, Email, Address, City, State_Province, Country, Postal) +VALUES(0 ,10001 , 'Pablo Picasso', "+34 636 17 63 82", '-', 'Paseo de la Chopera, 14,','Madrid' , 'Madrid', 'Spain', 28045), + (1 ,20001 , 'Abraham Lincoln', "+1 305 907 7086", '-', '120 SW 8th St','Miami', 'Florida', 'United States', 33130), + (2 ,30001 , 'Napoléon Bonaparte', "+33 1 79 75 40 00", '-','40 Rue du Colisée',' Paris', 'Île-de-France', 'France', 75008); + + +INSERT INTO lab_mysql.salespersons(ID,Staff_ID, Name, Store) +VALUES(0,00001 , 'Petey Cruiser' , 'Madrid'), +(1,00002 , 'Anna Sthesia', 'Barcelona'), +(2,00003 , 'Paul Molive', 'Berlin'), +(3,00004 , 'Gail Forcewind', 'Paris'), +(4,00005 , 'Paige Turner', 'Mimia'), +(5,00006 , 'Bob Finvoicesrapples', 'Mexico City'), +(6,00007 , 'Walter Melon', 'Amsterdam'), +(7,00008 , 'Shonda Leer', 'São Paulo'); + +INSERT INTO lab_mysql.invoices(ID, Invoice_number, Date, Car, Customer, Sales_Person) +VALUES(0, 852399038 , 20180222 , 0 , 1 , 3), +(1, 271135104 , 20190122 , 2 , 2 , 7), +(2, 731166526 , 20181231 , 3 , 0 , 5); + +SELECT * +FROM cars; + +SELECT * +FROM costumers; + +SELECT * +FROM invoices; + +SELECT * +FROM salespersons; diff --git a/your-code/update.sql b/your-code/update.sql index e69de29..2c41bab 100644 --- a/your-code/update.sql +++ b/your-code/update.sql @@ -0,0 +1,21 @@ +SELECT ID FROM salespersons WHERE Name = 'Paige Turner'; + +UPDATE salespersons +SET Store = 'Miami' +WHERE ID = 4; + +SELECT * +FROM salespersons; + +UPDATE costumers +SET Email = 'ppicasso@gmail.com' +WHERE ID = 0; +UPDATE costumers +SET Email = 'lincoln@us.gov' +WHERE ID = 1; +UPDATE costumers +SET Email = 'hello@napoleon.me' +WHERE ID = 2; + +SELECT * +FROM costumers;