diff --git a/your-code/Challenge 1 - Design the Database -Database relationships and Table planing.jpg b/your-code/Challenge 1 - Design the Database -Database relationships and Table planing.jpg new file mode 100644 index 0000000..ce4d542 Binary files /dev/null and b/your-code/Challenge 1 - Design the Database -Database relationships and Table planing.jpg differ diff --git a/your-code/Create the Database and Tables.sql b/your-code/Create the Database and Tables.sql new file mode 100644 index 0000000..b5dd55b --- /dev/null +++ b/your-code/Create the Database and Tables.sql @@ -0,0 +1,29 @@ +create DATABASE 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, + Costumer_Name VARCHAR(52), + Phone VARCHAR(32), + Email VARCHAR (52) DEFAULT 'jonhdoe@gmail.com', + Adress 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, + Invoice_Date DATE, + Car INT, + Costumer INT, + Sales_Person INT); + \ No newline at end of file diff --git a/your-code/Update records on Database.sql b/your-code/Update records on Database.sql new file mode 100644 index 0000000..c85a9f4 --- /dev/null +++ b/your-code/Update records on Database.sql @@ -0,0 +1,12 @@ +USE lab_mysql; +Update lab_mysql.costumers +SET email = 'ppicasso@gmail.com' +WHERE id = 0; +Update lab_mysql.costumers +SET email = 'lincoln@us.gov' +WHERE id = 1; +Update lab_mysql.costumers +SET email = 'hello@napoleon.me' +WHERE id = 2; + +SELECT * FROM lab_mysql.costumers; \ No newline at end of file diff --git a/your-code/create.sql b/your-code/create.sql deleted file mode 100644 index e69de29..0000000 diff --git a/your-code/delete record from Database.sql b/your-code/delete record from Database.sql new file mode 100644 index 0000000..afcbe36 --- /dev/null +++ b/your-code/delete record from Database.sql @@ -0,0 +1,5 @@ +USE lab_mysql; +DELETE FROM lab_mysql.cars +WHERE id in (4); + +SELECT * from lab_mysql.cars; \ No newline at end of file diff --git a/your-code/delete.sql b/your-code/delete.sql deleted file mode 100644 index e69de29..0000000 diff --git a/your-code/seeding the Database.sql b/your-code/seeding the Database.sql new file mode 100644 index 0000000..326a1c7 --- /dev/null +++ b/your-code/seeding the Database.sql @@ -0,0 +1,28 @@ +USE lab_mysql; +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, Costumer_Name, Phone, Email, Adress, City, State_Province, Country, Postal) +VALUES(0 ,10001 , 'Pablo Picasso', '34636176382', '-', 'Paseo de la Chopera, 14,','Madrid' , 'Madrid', 'Spain', 28045), + (1 ,20001 , 'Abraham Lincoln', '13059077086', '-', '120 SW 8th St','Miami', 'Florida', 'United States', 33130), + (2 ,30001 , 'Napoléon Bonaparte', '33179754000', '-','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, Invoice_Date, Car, Costumer, Sales_Person) +VALUES(0, 852399038 , 20180222 , 0 , 1 , 3), +(1, 271135104 , 20190122 , 2 , 2 , 7), +(2, 731166526 , 20181231 , 3 , 0 , 5); \ No newline at end of file diff --git a/your-code/seeding.sql b/your-code/seeding.sql deleted file mode 100644 index e69de29..0000000 diff --git a/your-code/update.sql b/your-code/update.sql deleted file mode 100644 index e69de29..0000000