Stack Exchange Data Explorerは、Stack Exchange データベースに対する SQL クエリを許可します。次のクエリ—</p>
select
month(CreationDate) month,
year(CreationDate) year,
sum(case when lower(left(Title,2))='wh' then 1 else 0 end)/count(*) wh,
(select sum(Score)/count(*)
from Posts u
where
month(CreationDate)=month(t.CreationDate) and
year(CreationDate)=year(t.CreationDate) and
lower(left(Title,2))='wh' and
PostTypeId=1 -- question
) wh_score,
sum(Score)/count(*) score,
(select sum(AnswerCount)/count(*)
from Posts u
where
month(CreationDate)=month(t.CreationDate) and
year(CreationDate)=year(t.CreationDate) and
lower(left(Title,2))='wh' and
PostTypeId=1 -- question
) wh_answers,
sum(AnswerCount)/count(*) answers
from Posts t
where PostTypeId=1 -- question
group by month(CreationDate), year(CreationDate)
;
— Scorpi0の厚意により— 結果のすべての整数値が得られます。すべてが丸められるか、切り捨てられます (どちらかはわかりません)。wh
(これは、すべての値が である列では特に厄介です0
。) 10 進数または値を強制する方法はありますか?