Questions by Time of Day and Day of Week

0

Please login or register to vote for this query.

(click on this box to dismiss)

Designed to consider whether "night" questions have more visibility than "day" questions

Stack Overflow

Q&A for professional and enthusiast programmers

-- Questions by Time of Day and Day of Week 
-- Designed to consider whether "night" questions have more visibility than "day" questions 
SELECT weekday, 
       daytime, 
       COUNT(*) questions 
FROM   (SELECT Datepart(weekday, posts.creationdate) weekday, 
               CASE Round(Datepart(HOUR, posts.creationdate)/4, 1) 
                 WHEN 0 THEN 'early morning' 
                 WHEN 1 THEN 'morning' 
                 WHEN 2 THEN 'late morning' 
                 WHEN 3 THEN 'afternoon' 
                 WHEN 4 THEN 'late afternoon' 
                 WHEN 5 THEN 'evening' 
               END                                   AS daytime 
        FROM   posts 
        WHERE  posttypeid = 1 -- 1 = Question 
       ) AS X
GROUP  BY weekday, 
          daytime 
ORDER  BY weekday, 
          daytime

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results