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
);

SELECT COUNT(*) FROM Posts WHERE AnswerCount = 0
);

-- The percentage of un-answered questions. Calculated
-- using this:
-- (Unanswered Questions / Total Site Questions) * 100
SELECT

-- The percentage of answered questions. Calculated
-- using this:
-- 100 - ((Unanswered Questions / Total Site Questions) * 100)
SELECT
100 - ((@UnansweredQuestions / @TotalQuestions) * 100.0)
• Any reason for not addressing questions that are in a non-responsive state (closed/on-hold)? Jul 8 '15 at 20:52
• @Snowhawk04 No, not really. I didn't think of that until after I posted. I'll probably post another question once I have changed it and added improvements from answers. Jul 8 '15 at 20:53
• @Quill Yup. I created this query specifically for Math.SE. Jul 8 '15 at 22:49
• In your description you say Unanswered Percentage = (Unanswered / Answered) * 100. I think you mean Unanswered Percentage = (Unanswered / Total) * 100, which would match your source. (And similarly for the other formula in your description.) Jul 9 '15 at 6:12
• I agree with @mathmandan. These percentage calculations are wrong. Jul 9 '15 at 13:04

Your comments are mostly clutter, and I mean that because your naming is good enough to where the comments are mostly irrelevant. Also, if you do need to make multi-line comment, you can use the same syntax in SQL as in pretty much everything else.

/**
* The percentage of un-answered questions. Calculated
* using this:
* (Unanswered Questions / Total Site Questions) * 100
*/
SELECT

There is an elegant way of assigning an alias in an expression that would make it even easier to read:

SELECT

Does exactly the same thing, but reads more like typical code, where you name a thing before assigning it something, rather than after.

Your first SELECT query is never displayed. There are two ways you could fix that, either by making them two different columns, or two different rows (according to your needs).

Columns:

SELECT
, [Perentage Of Answered Questions] = 100 - ((@UnansweredQuestions / @TotalQuestions) * 100.0); Rows:

SELECT
[Type of value] = 'Percentage Of Unanswered Questions'
, [Value] = (@UnansweredQuestions / @TotalQuestions) * 100.0
UNION
SELECT • Rather than subtracting $100$ from the unanswered percentage, simply generate the Answered Qs by subtracting the Unanswered Qs from the Total Qs and use the same formula for Unanswered Qs, like so: ((@TotalQuestions - @UnansweredQuestions) / @TotalQuestions) * 100.0