MLB Skills Assessment

0

Please login or register to vote for this query.

(click on this box to dismiss)

Buddhism Meta

Q&A about the site for people practicing or interested in Buddhist philosophy, teaching, and practice

-- *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 as 'QuestionID', 
  qa.CreationDate as 'Question_date', 
  qa.AcceptedAnswerid, 
  p.ID as 'AnswerID', 
  p.Creationdate as 'Answer_date', 
  datediff(second, qa.CreationDate, p.Creationdate) as 'Response_time'
into 
  #responsetime
from 
  posts p
inner join 
  questions_answered qa on qa.AcceptedAnswerid = p.id

Select
  --Count(*) as 'Number of Questions Answered',
  --sum(Response_time) as 'AVG Response Time'
  avg(cast(Response_time as bigint))
from 
  #responsetime

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results