├── .DS_Store ├── Car_Database.db ├── Car Dealership.vpp ├── Car_Database_ER_Diagram.png ├── yearly_purchases.sql ├── top2_sellers_by_units.sql ├── top2_sellers_by_price.sql ├── recall_check.sql ├── Triggers.sql ├── README.md ├── Create_Tables.sql └── Insert.sql /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaivpp/car_company_database/HEAD/.DS_Store -------------------------------------------------------------------------------- /Car_Database.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaivpp/car_company_database/HEAD/Car_Database.db -------------------------------------------------------------------------------- /Car Dealership.vpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaivpp/car_company_database/HEAD/Car Dealership.vpp -------------------------------------------------------------------------------- /Car_Database_ER_Diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtaivpp/car_company_database/HEAD/Car_Database_ER_Diagram.png -------------------------------------------------------------------------------- /yearly_purchases.sql: -------------------------------------------------------------------------------- 1 | /* Count of purchases aggregated by year, month, and week */ 2 | SELECT STRFTIME('%Y', CO.purchase_date) Date_Year, STRFTIME('%M', CO.purchase_date) Date_Month, CV.brand, strftime('%W', CO.purchase_date) Date_WeekNum, Count(CO.vin) 3 | FROM Customer_Ownership CO LEFT OUTER JOIN Car_Vins CV ON (CV.vin = CO.vin) 4 | GROUP BY STRFTIME('%Y', CO.purchase_date),STRFTIME('%M', CO.purchase_date), CV.brand; 5 | -------------------------------------------------------------------------------- /top2_sellers_by_units.sql: -------------------------------------------------------------------------------- 1 | /* Finds the top sellers by units sold for the past year */ 2 | SELECT B.brand_name, COUNT(B.brand_name) 3 | FROM Customer_Ownership as CO 4 | LEFT OUTER JOIN Car_Vins as CV on (CO.vin = CV.vin) 5 | LEFT OUTER JOIN Models as M on (CV.model_id = M.model_id) 6 | LEFT OUTER JOIN Brands as B on (B.brand_id = M.brand_id) 7 | WHERE CO.purchase_date > date('now','-1 year') 8 | GROUP BY B.brand_name 9 | ORDER BY COUNT(B.brand_name) DESC 10 | LIMIT 2; -------------------------------------------------------------------------------- /top2_sellers_by_price.sql: -------------------------------------------------------------------------------- 1 | /* Finds the top sellers by purchase price for the past year */ 2 | SELECT B.brand_name, SUM(CO.purchase_price) 3 | FROM Customer_Ownership as CO 4 | LEFT OUTER JOIN Car_Vins as CV on (CO.vin = CV.vin) 5 | LEFT OUTER JOIN Models as M on (CV.model_id = M.model_id) 6 | LEFT OUTER JOIN Brands as B on (B.brand_id = M.brand_id) 7 | WHERE CO.purchase_date > date('now','-1 year') 8 | GROUP BY B.brand_name 9 | ORDER BY SUM(CO.purchase_price) DESC 10 | LIMIT 2; -------------------------------------------------------------------------------- /recall_check.sql: -------------------------------------------------------------------------------- 1 | /* Update the part to be recalled */ 2 | UPDATE Car_Parts 3 | SET part_recall = 0 4 | WHERE part_name = 'Jetrag 6 Speed' and manufacture_start_date < date("2012-04-13") and manufacture_end_date > date("2012-04-13"); 5 | 6 | SELECT CO.customer_id, CO.vin 7 | FROM Customer_Ownership as CO 8 | LEFT OUTER JOIN Car_Vins as CV ON (CV.vin = CO.vin) 9 | LEFT OUTER JOIN Car_Options as COpt ON (COpt.option_set_id = CV.option_set_id) 10 | LEFT OUTER JOIN Car_Parts as CP on (CP.part_id = COpt.transmission_id) 11 | WHERE CP.part_recall = 1 and part_name='Jetrag 7 Speed'; 12 | -------------------------------------------------------------------------------- /Triggers.sql: -------------------------------------------------------------------------------- 1 | CREATE TRIGGER Option_Set_Model_Relation 2 | BEFORE INSERT ON Car_Vins 3 | BEGIN 4 | SELECT CASE 5 | WHEN( 6 | SELECT CO.model_id 7 | FROM Car_Options as CO 8 | WHERE 9 | NEW.option_set_id = CO.option_set_id and 10 | NEW.model_id = CO.model_id) 11 | THEN RAISE(FAIL, "Invlalid Option Set") 12 | END; 13 | END; 14 | 15 | CREATE TRIGGER validate_email_before_insert_customer 16 | BEFORE INSERT ON Customers 17 | BEGIN 18 | SELECT CASE 19 | WHEN NEW.email NOT LIKE '%_@__%.__%' THEN 20 | RAISE (ABORT,'Invalid email address') 21 | END; 22 | END; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Car Company Database 2 | For best viewing experiance please view at https://github.com/dtaivpp/car_company_database 3 | Also, please note these instructions are written from the perspective of the macOS however can still work with small modifications on windows or linux. 4 | 5 | ## About the Database 6 | This database is designed to handle the everyday operations of a major car company. It provides functionality to view the transactions of dealers, track car inventory, and maintain the models and avaliable options of cars. See the below file to view the Entity Relationship diagram for the database. 7 | The databases uses triggers, primary, and foreign keys to ensure the constraints of the database are maintianted upon insertion. Each entitiy has an autogenerated ID to ensure they are unique and to ensure that the transformations are easier. 8 | 9 | ![alt text](https://github.com/dtaivpp/car_company_database/blob/master/Car_Database_ER_Diagram.png?raw=true "ER Diagram") 10 | 11 | ### Setting up the database 12 | *Note this is using the already built database 13 | 1. First go ahead and download sqlite from here: https://www.sqlite.org/index.html using version 3.24.0 14 | 2. After installing open a commandline or terminal and clone the repositiory using `git clone https://github.com/dtaivpp/car_company_database.git` 15 | 3. From the terminal then navigate to the directory that you just cloned called car_company_database 16 | 4. Next run `sqlite3 Car_Database.db` to open the database in the terminal 17 | 18 | ### Building the database from scratch 19 | 1. Use steps 1 - 3 from the previous section 20 | 2. Alternatively you can build the database from the source files by running `sqlite3 .open {Name for your database here}.db` to create a new database 21 | 3. Next you would run from your sqlite shell `.read Create_Tables.sql` to create the tables 22 | 5. Run `.read Triggers.sql` from your sqlite shell to create the triggers to ensure inserts do not break any rules of the database such as adding a model with an invalid option set id. 23 | 5. Finally you would run `.read Insert.sql` from your sqlite shell to populate the tables with the data 24 | 25 | ### Running Sample SQL operations 26 | 1. If your database is alredy open skip to step 3. Otherwise open up a terminal and navigate to the directory your database is in. 27 | 2. Next run `sqlite3 Car_Database.db` to open the database in the terminal 28 | 3. Next you would run from your sqlite shell `.read {Query Name Here}.sql` without the curls to run the query from the file 29 | 30 | -------------------------------------------------------------------------------- /Create_Tables.sql: -------------------------------------------------------------------------------- 1 | Create Table Customers( 2 | customer_id INTEGER PRIMARY KEY AUTOINCREMENT, 3 | first_name VARCHAR(50) NOT NULL, 4 | last_name VARCHAR(50) NOT NULL, 5 | gender STRING CHECK(gender = "Male" or gender = "Female"), 6 | household_income INTEGER, 7 | birthdate DATE NOT NULL, 8 | phone_number INTEGER NOT NULL, 9 | email VARCHAR(128) 10 | ); 11 | 12 | Create Table Car_Vins( 13 | vin INTEGER PRIMARY KEY AUTOINCREMENT, 14 | model_id INTEGER NOT NULL, 15 | option_set_id INTEGER NOT NULL, 16 | manufactured_date DATE NOT NULL, 17 | manufactured_plant_id INTEGER NOT NULL, 18 | FOREIGN KEY (model_id) REFERENCES Models(model_id), 19 | FOREIGN KEY (manufactured_plant_id) REFERENCES Manufacture_Plant(manufacture_plant_id), 20 | FOREIGN KEY (option_set_id) REFERENCES Car_Options(option_set_id) 21 | ); 22 | 23 | Create Table Car_Options( 24 | option_set_id INTEGER PRIMARY KEY AUTOINCREMENT, 25 | model_id INTEGER NULL, 26 | engine_id INTEGER NOT NULL, 27 | transmission_id INTEGER NOT NULL, 28 | chassis_id INTEGER NOT NULL, 29 | premium_sound_id INTEGER, 30 | color VARCHAR(30) NOT NULL, 31 | option_set_price INTEGER NOT NUll, 32 | FOREIGN KEY (model_id) REFERENCES Models(model_id), 33 | FOREIGN KEY (engine_id) REFERENCES Car_Parts(part_id), 34 | FOREIGN KEY (premium_sound_id) REFERENCES Car_Parts(part_id), 35 | FOREIGN KEY (transmission_id) REFERENCES Car_Parts(part_id), 36 | FOREIGN KEY (chassis_id) REFERENCES Car_Parts(part_id) 37 | ); 38 | 39 | Create Table Car_Parts( 40 | part_id INTEGER PRIMARY KEY AUTOINCREMENT, 41 | part_name VARCHAR(100) NOT NULL, 42 | manufacture_plant_id INTEGER NOT NULL, 43 | manufacture_start_date DATE NOT NUll, 44 | manufacture_end_date DATE, 45 | part_recall INTEGER DEFAULT 0 CHECK (part_recall = 0 or part_recall = 1), 46 | FOREIGN KEY (manufacture_plant_id) REFERENCES Manufacture_Plant(manufacture_plant_id) 47 | ); 48 | 49 | Create Table Brands( 50 | brand_id INTEGER PRIMARY KEY AUTOINCREMENT, 51 | brand_name VARCHAR(50) NOT NUll 52 | ); 53 | 54 | Create Table Models( 55 | model_id INTEGER PRIMARY KEY AUTOINCREMENT, 56 | model_name VARCHAR(50) NOT NULL, 57 | model_base_price INTEGER NOT NULL, 58 | brand_id INTEGER NOT NULL, 59 | FOREIGN KEY (brand_id) REFERENCES Brands(brand_id) 60 | ); 61 | 62 | Create Table Customer_Ownership( 63 | customer_id INTEGER NOT NULL, 64 | vin INTEGER NOT NULL, 65 | purchase_date DATE NOT NULL, 66 | purchase_price INTEGER NOT NULL, 67 | warantee_expire_date DATE, 68 | dealer_id INTEGER NOT NULL, 69 | FOREIGN KEY (customer_id) REFERENCES Customers(customer_id), 70 | FOREIGN KEY (vin) REFERENCES Car_Vins(vin), 71 | FOREIGN KEY (dealer_id) REFERENCES Dealers(dealer_id) 72 | PRIMARY KEY (customer_id, vin) 73 | ); 74 | 75 | Create Table Manufacture_Plant( 76 | manufacture_plant_id INTEGER PRIMARY KEY AUTOINCREMENT, 77 | plant_name VARCHAR(50) NOT NULL, 78 | plant_type VARCHAR (7) CHECK (plant_type="Assembly" or plant_type="Parts"), 79 | plant_location VARCHAR(100), 80 | company_owned INTEGER CHECK(company_owned=0 or company_owned=1) 81 | ); 82 | 83 | Create Table Dealers ( 84 | dealer_id INTEGER PRIMARY KEY AUTOINCREMENT, 85 | dealer_name VARCHAR(50) NOT NULL, 86 | dealer_address VARCHAR(100) 87 | ); 88 | 89 | Create Table Dealer_Brand( 90 | dealer_id INTEGER NOT NULL, 91 | brand_id INTEGER NOT NULL, 92 | FOREIGN KEY (dealer_id) REFERENCES Dealers(dealer_id), 93 | FOREIGN KEY (brand_id) REFERENCES Brands(brand_id), 94 | PRIMARY KEY (dealer_id, brand_id) 95 | ); 96 | 97 | 98 | -------------------------------------------------------------------------------- /Insert.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO Dealers (dealer_name,dealer_address) Values('Joes Autos', '123 Abc Lane Virginia'); 2 | INSERT INTO Dealers (dealer_name,dealer_address) Values('Priority X', '999 Nein-Nein Virginia'); 3 | INSERT INTO Dealers (dealer_name,dealer_address) Values('Priority Y', '404 Address Not Found'); 4 | INSERT INTO Dealers (dealer_name,dealer_address) Values('Priority Z', '8675309 Jessies Mom'); 5 | INSERT INTO Brands(brand_name) Values('Cover Squirrel'); 6 | INSERT INTO Brands(brand_name) Values('Supreme'); 7 | INSERT INTO Brands(brand_name) Values('Yellow'); 8 | INSERT INTO Brands(brand_name) Values('Ferrari'); 9 | INSERT INTO Brands(brand_name) Values('Boujiee'); 10 | INSERT INTO Brands(brand_name) Values('Freshest'); 11 | INSERT INTO Dealer_Brand(dealer_id, brand_id) Values(1,1); 12 | INSERT INTO Dealer_Brand(dealer_id, brand_id) Values(1,3); 13 | INSERT INTO Dealer_Brand(dealer_id, brand_id) Values(1,6); 14 | INSERT INTO Dealer_Brand(dealer_id, brand_id) Values(1,5); 15 | INSERT INTO Dealer_Brand(dealer_id, brand_id) Values(2,2); 16 | INSERT INTO Dealer_Brand(dealer_id, brand_id) Values(2,3); 17 | INSERT INTO Dealer_Brand(dealer_id, brand_id) Values(2,5); 18 | INSERT INTO Dealer_Brand(dealer_id, brand_id) Values(2,1); 19 | INSERT INTO Dealer_Brand(dealer_id, brand_id) Values(3,5); 20 | INSERT INTO Dealer_Brand(dealer_id, brand_id) Values(3,6); 21 | INSERT INTO Dealer_Brand(dealer_id, brand_id) Values(3,2); 22 | INSERT INTO Dealer_Brand(dealer_id, brand_id) Values(4,2); 23 | INSERT INTO Dealer_Brand(dealer_id, brand_id) Values(4,4); 24 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("The Blonde", 23000, 1); 25 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("The Brunette", 25000, 1); 26 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("The Red Head", 29000, 1); 27 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("Hat", 22000, 2); 28 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("Sweater", 25000, 2); 29 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("T-Shirt", 27000, 2); 30 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("Orange", 15000, 3); 31 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("Blue", 12000, 3); 32 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("Green", 17000, 3); 33 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("LaFerrari", 125000, 4); 34 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("450", 75000, 4); 35 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("F12 Berlinetta", 110000, 4); 36 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("F40", 100000, 4); 37 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("Extra", 30000, 5); 38 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("Too Much", 35000, 5); 39 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("Beats", 24000, 6); 40 | INSERT INTO Models(model_name, model_base_price, brand_id) Values("Bars", 35000, 6); 41 | INSERT INTO Manufacture_Plant(plant_name, plant_type, plant_location, company_owned) Values("West Plant", "Parts", "Europe",1); 42 | INSERT INTO Manufacture_Plant(plant_name, plant_type, plant_location, company_owned) Values("East Plant", "Parts", "Asia",1); 43 | INSERT INTO Manufacture_Plant(plant_name, plant_type, plant_location, company_owned) Values("North Plant", "Assembly", "Asia",1); 44 | INSERT INTO Manufacture_Plant(plant_name, plant_type, plant_location, company_owned) Values("South Plant", "Assembly", "Australia",1); 45 | INSERT INTO Manufacture_Plant(plant_name, plant_type, plant_location, company_owned) Values("Scranton Branch", "Parts", "USA",0); 46 | INSERT INTO Car_Parts(part_name, manufacture_plant_id, manufacture_start_date, manufacture_end_date) Values ('2.6L Engine', 1, '2012-08-12', '2013-08-12'); 47 | INSERT INTO Car_Parts(part_name, manufacture_plant_id, manufacture_start_date, manufacture_end_date, part_recall) Values ('3.0L Engine', 2, '2012-07-10', '2017-02-20', 0); 48 | INSERT INTO Car_Parts(part_name, manufacture_plant_id, manufacture_start_date, manufacture_end_date, part_recall) Values ('2.4L Engine', 5, '2012-08-12', '2013-08-12', 0); 49 | INSERT INTO Car_Parts(part_name, manufacture_plant_id, manufacture_start_date, manufacture_end_date, part_recall) Values ('Jetrag 6 Speed', 5, '2012-02-11', '2013-08-12', 0); 50 | INSERT INTO Car_Parts(part_name, manufacture_plant_id, manufacture_start_date, manufacture_end_date, part_recall) Values ('Bose Audio', 1, '2014-08-02', '2015-03-12', 0); 51 | INSERT INTO Car_Parts(part_name, manufacture_plant_id, manufacture_start_date, manufacture_end_date, part_recall) Values ('4WD Chassis', 2, '2000-08-29', '2017-05-12', 0); 52 | INSERT INTO Car_Parts(part_name, manufacture_plant_id, manufacture_start_date, manufacture_end_date, part_recall) Values ('2WD Chassis', 2, '2005-12-20', '2017-11-01', 0); 53 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, premium_sound_id, color, option_set_price) Values(4,2,4,6,5,"Blue",2000); 54 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, premium_sound_id, color, option_set_price) Values(5,2,4,6,5,"Yellow",1200); 55 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, premium_sound_id, color, option_set_price) Values(6,1,4,7,5,"Green",1100); 56 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, premium_sound_id, color, option_set_price) Values(15,1,4,7,5,"Red",4000); 57 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, premium_sound_id, color, option_set_price) Values(14,2,4,7,5,"Sky",3000); 58 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, premium_sound_id, color, option_set_price) Values(16,2,4,7,5,"Birthday Cake",2500); 59 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, premium_sound_id, color, option_set_price) Values(17,3,4,6,5,"Cyan",7000); 60 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, premium_sound_id, color, option_set_price) Values(10,1,4,6,5,"Purple",2500); 61 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, premium_sound_id, color, option_set_price) Values(11,2,4,6,5,"Red",10000); 62 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, premium_sound_id, color, option_set_price) Values(12,2,4,7,5,"Blue",11300); 63 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, premium_sound_id, color, option_set_price) Values(13,1,4,7,5,"Green",23000); 64 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(1,1,4,7,"Black",1100); 65 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(2,1,4,7,"Blue",2000); 66 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(3,1,4,6,"Red",1500); 67 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(4,3,4,6,"Yellow",4000); 68 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(5,2,4,6,"Black",3600); 69 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(7,2,4,6,"White",2300); 70 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(8,2,4,7,"Pretty",2200); 71 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(9,3,4,7,"Glitter BomB",2900); 72 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(14,1,4,7,"Nyan",7999); 73 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(12,1,4,7,"Ultraviolet",25000); 74 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(11,1,4,7,"Transparent",40000); 75 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(6,2,4,6,"Green",1200); 76 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(2,1,4,6,"Purple",3900); 77 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(1,2,4,7,"Red",900); 78 | INSERT INTO Car_Options(model_id, engine_id, transmission_id, chassis_id, color, option_set_price) Values(11,2,4,6,"Magenta",200); 79 | INSERT INTO Customers(first_name, last_name, gender, household_income, birthdate, phone_number, email) Values("Jeremy","Jacobs","Male",120000,"1990-12-12",9177554315,"Jeremy@Gmail.com"); 80 | INSERT INTO Customers(first_name, last_name, gender, household_income, birthdate, phone_number, email) Values("Maria","Swabota","Female",60000,"1980-06-15",7577749387,"Maria@Gmail.com"); 81 | INSERT INTO Customers(first_name, last_name, gender, household_income, birthdate, phone_number, email) Values("Jacob","Wong","Male",24000,"1992-02-20",2129990234,"WonTon@hotmail.com"); 82 | INSERT INTO Customers(first_name, last_name, gender, household_income, birthdate, phone_number, email) Values("Pitbull","Perez","Male",1200000,"1985-12-01",7892341827,"Pitbull@ymail.com"); 83 | INSERT INTO Customers(first_name, last_name, gender, household_income, birthdate, phone_number, email) Values("Minnie","Mouse","Female",200000,"1950-03-01",7542890987,"MinnieMe@gmail.com"); 84 | INSERT INTO Customers(first_name, last_name, gender, household_income, birthdate, phone_number, email) Values("Jessica","Parker","Female",120000,"1989-06-29",4245679000,"JennyFromThePark@mymail.com"); 85 | INSERT INTO Car_Vins(model_id, option_set_id, manufactured_date, manufactured_plant_id) Values(7,17,"2017-02-20",4); 86 | INSERT INTO Car_Vins(model_id, option_set_id, manufactured_date, manufactured_plant_id) Values(14,5,"2016-09-19",3); 87 | INSERT INTO Car_Vins(model_id, option_set_id, manufactured_date, manufactured_plant_id) Values(12,10,"2014-11-14",3); 88 | INSERT INTO Car_Vins(model_id, option_set_id, manufactured_date, manufactured_plant_id) Values(2,13,"2013-03-04",4); 89 | INSERT INTO Car_Vins(model_id, option_set_id, manufactured_date, manufactured_plant_id) Values(4,1,"2013-06-22",4); 90 | INSERT INTO Customer_Ownership(customer_id, vin, purchase_date, purchase_price, warantee_expire_date, dealer_id) Values(6,1,"2017-12-21",17200,"2025-05-12",2); 91 | INSERT INTO Customer_Ownership(customer_id, vin, purchase_date, purchase_price, warantee_expire_date, dealer_id) Values(5,2,"2016-10-14",33000,"2024-04-19",1); 92 | INSERT INTO Customer_Ownership(customer_id, vin, purchase_date, purchase_price, warantee_expire_date, dealer_id) Values(2,3,"2015-12-01",121300,"2026-03-03",4); 93 | INSERT INTO Customer_Ownership(customer_id, vin, purchase_date, purchase_price, warantee_expire_date, dealer_id) Values(3,4,"2017-08-09",26000,"2090-02-14",1); 94 | INSERT INTO Customer_Ownership(customer_id, vin, purchase_date, purchase_price, warantee_expire_date, dealer_id) Values(1,5,"2017-02-24",24000,"2027-01-12",3); 95 | --------------------------------------------------------------------------------