From f64d73620a3074ba0ee7e9a96a6550731f1c5df1 Mon Sep 17 00:00:00 2001 From: Fernando Carvalho Date: Mon, 24 Apr 2023 00:04:09 +0100 Subject: [PATCH] done --- your-code/car_company.sql | 88 +++++++++++++++++++++++++++ your-code/cars_data_base_squema.xlsx | Bin 0 -> 10952 bytes your-code/create.sql | 42 +++++++++++++ your-code/delete.sql | 2 + your-code/seeding.sql | 29 +++++++++ your-code/update.sql | 3 + 6 files changed, 164 insertions(+) create mode 100644 your-code/car_company.sql create mode 100644 your-code/cars_data_base_squema.xlsx diff --git a/your-code/car_company.sql b/your-code/car_company.sql new file mode 100644 index 0000000..abbeed5 --- /dev/null +++ b/your-code/car_company.sql @@ -0,0 +1,88 @@ +CREATE DATABASE car_company; + +CREATE TABLE IF NOT EXISTS car_company.car( + + vin VARCHAR(17) NOT NULL PRIMARY KEY , + manufacturer VARCHAR(52)NOT NULL, + model VARCHAR(50)NOT NULL, + car_year DATE NOT NULL, + color VARCHAR(30) NOT NULL, + car_index int NOT NULL); + +CREATE TABLE IF NOT EXISTS car_company.costumers( + + costumer_id INT(12) NOT NULL PRIMARY KEY AUTO_INCREMENT, + cost_name VARCHAR(72), + phone VARCHAR(32), + email VARCHAR(52), + address VARCHAR(52), + city VARCHAR(52), + state VARCHAR(52), + country VARCHAR(52), + zip_postal VARCHAR(10), + costum_index INT); + +CREATE TABLE IF NOT EXISTS car_company.sales_person( + + staff_id INT(12) NOT NULL PRIMARY KEY AUTO_INCREMENT, + staff_name VARCHAR(72), + store_name VARCHAR(72), + person_index INT); + +CREATE TABLE IF NOT EXISTS car_company.invoice( + + invoice_num INT(12) NOT NULL PRIMARY KEY , + vin VARCHAR(17) NOT NULL, + costumer_id INT(12) NOT NULL, + staff_id INT(12) NOT NULL, + inv_date DATE, + price FLOAT, + inv_index INT + ); + +SET sql_mode = "NO_AUTO_VALUE_ON_ZERO"; + +INSERT INTO car_company.car (vin,manufacturer, model, car_year, color, car_index) VALUES + ('3K096I98581DHSNUP', 'Volkswagen', 'Tiguan',2019,'Blue',0), + ('ZM8G7BEUQZ97IH46V', 'Peugeot', 'Rifter',2019,'Red',1), + ('RKXVNNIHLVVZOUB4M', 'Ford', 'Fusion',2018,'White',2), + ('HKNDGS7CU31E9Z7JW', 'Toyota', 'RAV4',2018,'Silver',3), + ('DAM41UDN3CHU2WVF6', 'Volvo', 'V60',2019,'Gray',4), + ('DAM41UDN0CHU2WVF6', 'Volvo', 'V60 Cross Country',2019,'Pink',5); + +INSERT INTO car_company.costumers (costumer_id,cost_name,phone, email, address, city, state,country,zip_postal,costum_index) VALUES + (10001, 'Pablo Picasso', '+34 636 17 63 82','-','Paseo de la Chopera 14','Madrid','Madrid','Madrid','2845',0), + (20001, 'Abraham Lincoln', '+1 305 907 7086','-','120 SW 8th St','Miami','Florida','United States','33130',1), + (30001, 'Napoléon Bonaparte', '+33 1 79 75 40 00','-','40 Rue du Colisée ','Paris',' Île-de-France','France','75008',2); + +INSERT INTO car_company.sales_person (staff_id,staff_name,store_name,person_index) VALUES + (00001, 'Petey Cruiser', 'Madrid',0), + (00002, 'Anna Sthesia', 'Barcelona',1), + (00003, 'Paul Molive', 'Berlin',3), + (00004, 'Gail Forcewind', 'Paris',4), + (00005, 'Paige Turnere', 'Mimia',5), + (00006, 'Bob Frapples', 'Mexico City',6), + (00007, 'Walter Melon', 'Amsterdam',7), + (00008, 'Shonda Leer', 'São Paulo',8); + +INSERT INTO car_company.invoice (invoice_num,vin,costumer_id,staff_id,inv_date,price,inv_index) VALUES + (852399038, 'DAM41UDN3CHU2WVF6', 00002,3436,22-08-2018,15000,0), + (731166526, 'RKXVNNIHLVVZOUB4M', 00005,2453,31-12-2018,30000,1), + (271135104, 'ZM8G7BEUQZ97IH46V', 00008,3464,22-01-2019,36547,2); + +#BONUS €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ + +UPDATE car_company.sales_person +SET store_name = 'Miami' +WHERE staff_id = '00005'; + +DELETE FROM car_company.car +WHERE car_index = 4; + +#€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ + + + + + + \ No newline at end of file diff --git a/your-code/cars_data_base_squema.xlsx b/your-code/cars_data_base_squema.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..31fa10beb52d4bfd5650c8f5dafcb7e875566338 GIT binary patch literal 10952 zcmeHt1ydZ`*7o4;gS$g;celV0+zIYZ&_RN`J3#|Mg9U;lc#xpMAy{yCcl+kpn{#r{ z_Y3arsp_t-p7m7sUjD4D0)l}B0^k9N004jzAi)UweJLkLHw#BM zBMmQS3s(bHu!B9tJ6LFjJODK0|NlGwi&vmRqu;TU9kW$?S4_H1D>6U4tPGK)iA0}f z8{rK&Nr$FkgOK6=HNB;(W({Hot*ZTqKHZrxLFF8suB7;yJ?pKmGL11xNo=LdiO9qA zw=zM66i3DG=x1ZYP`@Due2il669S#7DFsA%zc>X5m%I!={#B+Dbjq-a~8ZI(gb z%`N6?zEJO;6+AS@roLpKoAF^CYHCa=xVi|!oDvfow~!C4A--L?!KbRNR|OTi+!alq(?A;h3|zEbKx0&;K(*bE=R(N zS8E8OYZ#`@0${P}0PCE@wGw(8>Ev9C5C0hdE(JYqlAk|5dk&E9X@Z|vC3t}f8;H6u zv)I5-=q}o)XWSDK-28 zU}_Kr!^ru!`rQxAF9^r(_EBE0a#uuS1BIv?JS)S}Z(q41Jfm|-lYLdO(v9UYbuo3B zA*bNQ;L#fYto(CnKB#|*T6W?@x(0KERhtM2r-&pBPb4EyujhsCqUm)N)Rd(9L1kF= zC%(Mh9pbsRa=o;97yf#6+$V!MUfq01UFChp{Xx;>rHhb^^`B0n0Tfkx z4Fdr9LQ)$BWM#niY@SXocBW2FcE9DZ3QYs20zu5z?c)y^5uW(-E7TG%v{$H`66Z9h zEa%gor@|EH0fv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