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/car_company.mwb
Binary file not shown.
Binary file added your-code/car_company.mwb.bak
Binary file not shown.
58 changes: 58 additions & 0 deletions your-code/create.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
create database car_company;

create table if not exists cars (
car_id int primary key,
vin varchar(52),
manufacturer varchar(52),
model varchar(52),
year int,
color varchar(52)
);


create table if not exists customers (
id_c int primary key,
customer_id int,
name_cost varchar(52),
phone_number varchar(52),
email varchar(52) default 'data_team@ironhack.com',
adress varchar(52),
city varchar(52),
st_province varchar(52),
country varchar(52),
zip int
);

create table if not exists salesperson (
id_s int primary key,
staff_id int,
name_staff varchar(52),
store_company varchar(52)
);

create table if not exists invoices (
id_i int primary key,
inv_number int,
date varchar(52),
car_id int,
id_c int,
id_s int
);

alter table invoices
ADD foreign key (car_id) references cars(car_id);

alter table invoices
ADD foreign key (id_c) references customers(id_c);

alter table invoices
ADD foreign key (id_s) references salesperson(id_s);


select *
from customers;

select*
from cars;


37 changes: 37 additions & 0 deletions your-code/seeding.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@


insert into car_company.cars(car_id, vin, manufacturer, model, 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 car_company.customers(id_c, customer_id, name_cost, phone_number, adress, city, st_province, country, zip)
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");
/* the phone number i put as srt because one of the values have more than ten so given error out of range*/

insert into car_company.salesperson(id_s, staff_id, name_staff, store_company)
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 Frapples", "Mexico City"),
(6, 00007, "Walter Melon", "Amsterdam"),
(7, 00008, "Shonda Leer", "São Paulo");

insert into car_company.invoices(id_i,inv_number, date, car_id, id_c, id_s)
value(0, 852399038, "22-08-2018", 0, 1, 3),
(1, 731166526, "31-12-2018", 3, 0, 5),
(2, 271135104, "22-01-2019", 2, 2, 7);

select *
from customers;

select*
from cars;
20 changes: 20 additions & 0 deletions your-code/update.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
update car_company.customers
set email = "ppicasso@gmail.com"
where id_c = 0;

update car_company.customers
set email = "lincoln@us.gov"
where id_c = 1;

update car_company.customers
set email = "hello@napoleon.me"
where id_c = 2;


select *
from customers;