I've refactored my previous query and added better checks when selecting the data. The query link can be found here. The formulas used to calculate the two percentages are the same, and can be seen 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 FLOAT = (
SELECT COUNT(*) FROM Posts WHERE
PostTypeId = 1
AND ClosedDate IS NULL
);
DECLARE @UnansweredQuestions FLOAT = (
SELECT COUNT(*)
FROM Posts AS TopPostsQuery WHERE (
ClosedDate IS NULL
AND PostTypeId = 1
AND AnswerCount = 0
)
OR (
ClosedDate IS NULL
AND PostTypeId = 1
AND AnswerCount <= 1
AND AcceptedAnswerId IS NULL
AND (
SELECT Score FROM Posts AS SubPostsQuery WHERE
PostTypeId <> 1
AND ParentId = TopPostsQuery.Id
) <= 0
)
);
DECLARE @AnsweredPercentage FLOAT =
100.0 - ((@UnansweredQuestions / @TotalQuestions) * 100.0);
DECLARE @UnansweredPercentage FLOAT =
(@UnansweredQuestions / @TotalQuestions) * 100.0;
SELECT
[Percentage Of Answered Questions] = @AnsweredPercentage
, [Percentage Of Unanswered Questions] = @UnansweredPercentage;