MLB Skills Assessment

-- *BONUS* For the questions created in 2017, what was the average time (in seconds) between when the question was created and when the accepted answer was provided?
;with questions_answered as (
select
ID,
CreationDate,
AcceptedAnswerid
from
posts
where
year(creationdate) = 2017
and Acceptedanswerid is not null
)
Select
qa.ID,
qa.CreationDate as 'Question_date',
qa.AcceptedAnswerid,
p.ID,
p.Creationdate as 'Answer_date'
from
posts p
inner join
questions_answered qa on qa.id = p.AcceptedAnswerid