Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We want to know which electric vehicles have made the most year - on - year improvement in electric range. Write a query using common
We want to know which electric vehicles have made the most yearon
year improvement in electric range. Write a query using common table ex
pressions to return the vehicles make model that made the most single year
improvement to their electric range. Output just the top largest yearon
year improvements. The output table should have at least seven columns extra
evwa
Columns
id
vin
county
city
state
postalcode
modelyear
make
model
evtype
cafveligibilit.
electricrange
basemsrp
censustractcolumns are okay: make, model, year year rangerange in year range
range in year and diff difference in the range between the two years
Note: A single year improvement is made between adjacent years, eg the
improvement between and Hypothetically, if Toyota Ravs had an
electric range of in and in the yearonyear improvement would
be If the range were in and in the yearonyear improvement
would be not an improvement at all
Hint: This query should build upon your previous query. If you are having
difficulty with the previous query, you can still get partial credit on this problem
by writing the rest of the query assuming your query from problem is correct.
Next, we want to know whether there is a relationship between median household
income and prevalence of electric cars. We will use census tract as a minimum geo
graphic unit. Median household income per census tract can be found in the income
table, with each tract identified by the census geo ID This geo ID maps to the census
tracts in the evwa table.
However, the census tract identifier from the evwa table takes a different form than
the censusgeoid from the income table. You will need a new function SUBSTRING
to join the two tables in this database on census tract. The following example query
joins these two columns together by taking a substring of censusgeoid and match
ing it against censustract. A few rows of the resulting join are provided for reference.
SELECT ecensustract, icensusgeoid
FROM evwa e
JOIN income i ON SUBSTRINGicensusgeoid ecensustract
LIMIT ;
censustract censusgeoid
US
US
US
US
US
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started