Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Run the following script to setup the fuel prices tables (if you have not done s

ID: 3713224 • Letter: R

Question

Run the following script to setup the fuel prices tables (if you have not done so already):

Here is an ERD of the tables. Note that there are no foreign keys setup for these tables.

Write a single query that shows the average fuel price each year for item code 74714 in the area code A207 , during the summer months of June through August, during the 1990's. There should be one row per year. Order the results by year. Make sure all columns have reasonable column headings. Round results to two decimal places.

For this query you may use the codes for the periods (e.g. M06 for June).

Screenshot #5: Fuel Prices Query

Explanation / Answer

SELECT ROUND(AVG(fp.Value),2) as AVERAGE_FUEL_PRICE

FROM FuelPrice fp

WHERE fp.AreaCode='A207' AND fp.ItemCode='74714' AND

fp.PeriodCode IN ('M06', 'M07', 'M08') AND fp.DataYear='1990'

GROUP BY fp.DataYear

ORDER BY fp.DataYear;