I put together this simple query which calculates the total percentage of answered questions and unanswered questions. The formulas used to calculate these are shown below:
$$ \text{Answered Percentage} = 100 - \left(\frac{\text{Unanswered}}{\text{Answered}} \times 100\right) \\ \text{Unanswered Percentage} = \frac{\text{Unanswered}}{\text{Answered}} \times 100 $$
Finally, here's the source:
DECLARE @TotalQuestions DECIMAL = (
SELECT COUNT(*) FROM Posts
);
DECLARE @UnansweredQuestions DECIMAL = (
SELECT COUNT(*) FROM Posts WHERE AnswerCount = 0
);
-- The percentage of un-answered questions. Calculated
-- using this:
-- (Unanswered Questions / Total Site Questions) * 100
SELECT
(@UnansweredQuestions / @TotalQuestions) * 100.0
AS [Percentage Of Unanswered Questions];
-- The percentage of answered questions. Calculated
-- using this:
-- 100 - ((Unanswered Questions / Total Site Questions) * 100)
SELECT
100 - ((@UnansweredQuestions / @TotalQuestions) * 100.0)
AS [Perentage Of Answered Questions];
Unanswered Percentage = (Unanswered / Answered) * 100
. I think you meanUnanswered Percentage = (Unanswered / Total) * 100
, which would match your source. (And similarly for the other formula in your description.) \$\endgroup\$