Stack Exchange Data Explorer query to find upvoted questions with only downvoted answers
Answering your questions in reverse order…

Your HAVING clause is clearer than than an anti-join condition in the WHERE clause.  It is also more efficient — tick the "Include execution plan" checkbox to see how much more complicated the anti-join is.  You could do better, though:  MAX(a.Score) &lt; 0 also means that all answers have a net negative score.

Given the choice between selecting MAX(q.Score) and grouping by q.Score, I'd prefer the latter.  Both are annoying, but the SQL standard requires that you do one or the other, so that all columns are either mentioned in GROUP BY or are aggregated.

I can provide some style tips, but keep in mind that these are my personal recommendations.  I don't believe that there is a standard SQL style guide — and certainly nothing as formalized as PEP 8.


Fill in the description to your Data Explorer query.  Otherwise, there is a huge gap between the information contained in the title and the SQL.  Detail exactly what the query does.  Mention your motivation for writing the query.  State what the sort order is.
Indent more.  The FROM, WHERE, GROUP BY, HAVING, and ORDER BY clauses are all subsidiary to the SELECT, and therefore should be at the next indentation level.
Finishing the query with a semicolon is a good habit.
Move comments to the right to be less obtrusive.
I like to put commas before the selected columns.  That convention makes it easier to add and remove columns.
Prefer comparing with 0 instead of comparing with any other constant.




SELECT q.Id AS [Post Link] -- Alias makes Data Explorer do magic link rendering
     , q.Score AS [Score]
     , COUNT(a.Id) AS [AnswerCount]
     , AVG(CAST(a.Score AS float)) AS [AvgAnswerScore]
    FROM Posts AS q
        INNER JOIN Posts AS a
            ON q.Id = a.ParentId
    WHERE
        q.Score &gt; 0        -- Question has a positive score
    GROUP BY
        q.Id, q.Score
    HAVING
        MAX(a.Score) &lt; 0   -- Best answer has a negative score
    ORDER BY
        [Score] DESC,
        [AnswerCount] DESC;


I'd like to point out: good job remembering to CAST(a.Score AS float) before taking the average.  SQL Server is tricky, in that AVG() of ints is an int.