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 ERD_lab.mwb
Binary file not shown.
Binary file added ERD_lab.mwb.bak
Binary file not shown.
44 changes: 44 additions & 0 deletions create.sql
Original file line number Diff line number Diff line change
@@ -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)
);
2 changes: 2 additions & 0 deletions delete.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
delete from cars
where VIN = 'DAM41UDN3CHU2WVF6';
31 changes: 31 additions & 0 deletions seeding.sql
Original file line number Diff line number Diff line change
@@ -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', '[email protected]', 'Paseo de la Chopera, 14', 'Madrid', 'Madrid', 'Spain', 28045),
(20001, 'Abraham Lincoln', '+13059077086', '[email protected]', '120 SW 8th St', 'Miami', 'Florida', 'United States', 33130),
(30001, 'Napoléon Bonaparte', '+33179754000', '[email protected]', '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);

11 changes: 11 additions & 0 deletions update.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
update customers
set Email = '[email protected]'
where Name = 'Pablo Picasso';

update customers
set Email = '[email protected]'
where Name = 'Abraham Lincoln';

update customers
set Email = '[email protected]'
where Name = 'Napoléon Bonaparte';