Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added your-code/DB_Design_page-0001.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions your-code/create.sql
Original file line number Diff line number Diff line change
@@ -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
);
4 changes: 4 additions & 0 deletions your-code/delete.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DELETE FROM cars
WHERE id = 4;

SELECT * FROM cars;
40 changes: 40 additions & 0 deletions your-code/seeding.sql
Original file line number Diff line number Diff line change
@@ -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;
21 changes: 21 additions & 0 deletions your-code/update.sql
Original file line number Diff line number Diff line change
@@ -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;