Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write PostgreSQL scripts to calculate following scenarios based on the two tables below (#1 and #2). Mileage totals has 259 entrees and the Fleet

Please write PostgreSQL scripts to calculate following scenarios based on the two tables below (#1 and #2). Mileage totals has 259 entrees and the Fleet table has 30.

1) What is the maximum mileage of all vehicles in service? (in service vehicles are rented, or owned) Include your select statement and the result.

2) What is the average mileage of vehicles that have been sold?

3) What problems do you see in adding a Tesla S3 to the current fleet tracking software?

4) write a sql statement to select trip mileage in addition to the current columns on MileageTrack for vehicle 18. Hint: it will include a subquery IN THE COLUMN SECTION OF YOUR SELECT STATEMENT, not the where clause.

Here is sample data from Mileage Totals TABLE:image text in transcribed

And here is the fleet table:

image text in transcribed

1 id VehicleID Date 15 9/1/2015 15 9/5/2015 15 9/9/2015 15 9/13/2015 15 9/19/2015 15 9/27/2015 15 10/5/2015 1 1/1/2016 1 1/6/2016 11/12/2016 11/21/2016 1 1/30/2016 12/8/2016 12/16/2016 1 2/25/2016 7 3/1/2016 1 3/5/2016 1 3/10/2016 7 3/10/2016 1 3/15 TotalMileage Gallons 22417 22655 22785 23007 23173 23380 23616 23127 23326 23469 23704 23846 24041 24180 24323 45618 24536 24655 45778 12 13 12 2 18 12 16 10 15 17 12 16 10 10 13 16 17 18 19 20 15 12 17 12 13 17 16 17 License Make Mode Year ViJ LP0001 Honda Accord 2014 VIN1 Owned Sales car Rent-Retur Oper rational CLP0002 Toyota Scion 2014 VIN 2 3 Owned Manager Car LP0003 Mazda Mazda 32015 VIN 3 4 OwnedM 5 Rent Manager Car LP0004 Ford Focus 2015 VIN Operational CLP0005 Honda Civic Operational CLP0006 Ford Explorer 2016 VIN6 Operational CLP0007 ChevyLu Operational CLP0008 Chey Operational CLP0009 Ford Crown 2016 VIN9 2015 VIN 5 7 OwnedO 8 Rent 9 Rent mina 2017VIN 7 umina 2018 VIN eratinal LP0010 Toyota Rav4 Operational CLP0011 Toyota Highland2018VIN 11 Operational CLP0012 FordExplorer 2016 VIN 12 Operational CLP0013 Honda Civic Operational CLP0014 HundaiSonata 2018 VIN 14 Operational CLP0015 TaTa Explorer 2016 VIN 15 Operational CLP0016 FordTaurus 2017 VIN 16 Operational CLP0017 CadillaclEscalad 2018 VIN 17 10 OwnedOpe 2017 VIN 10 OwnedO 12 OwnedO 13 Sold 14 OwnedO 15 OwnedO 6 Sold 17 OwnedO 18 Owned Sales car 19 Sold 20 OwnedO 2017 VIN 13 Operational CLP0019 Honda Pilot Operational CLP0020 Chevy [Au Operational CLP0021 Kia LP0018 Touota Avalon 2016 VIN 18 2017 VIN 19 2018 VIN 20 2016 VIN 21 Soul 22 Rent-Retur Operational CLP0022 MMazda ICR5 23 OwnedO 24 OwnedO 25 Rent-Returl Operational CjP0025 | Toyota | 4Runner! 2017 | VIN 25 26 Owned 27 OwnedO 28 Sold 29 Owned 30 Owned Operation Operational CLP0023 Ford F-150 Operational CLP0024 Nissan Titan 2018 VIN 23 2016 VIN 24 Operational C. LP0026 | Dodge | Avenged 2018 | VIN 26 Operational CLP0027 D Operational CLP0028 Dodge Avenge2017VIrN 28 Operational CLP0029 GMMC Terrain 2018 VIN 29 Dodge Ram 2016 VIN 27 al C. LP0030 | GMC | Terrain | 2014 | VIN 30

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions