In light of the recent "SQL frenzy" of sorts in The 2nd Monitor, I decided to take a stab at writing my own SEDE query. Essentially, what it does is find questions that could be answered based on the following parameters.
-- @MinQuestionVotes - The minimum amount of votes on a question. -- @MaxQuestionAnswers - The maximum amount of answers to a question. -- @QuestionTags - The tags that should be on the questions.
At the moment, I feel that those parameters are necessary for finding possible questions to answer, but if you feel that one isn't needed, just mention it. Anyways, here's the code, and here's the SEDE query link.
-- User parameters for finding questions. Here is -- a brief description of what each parameter does. -- @MinQuestionVotes - The minimum amount of votes on a question. -- @MaxQuestionAnswers - The maximum amount of answers to a question. -- @QuestionTags - The tags that should be on the questions. DECLARE @MinQuestionVotes INT = ##MinQuestionVotes##; DECLARE @MaxQuestionAnswers INT = ##MaxQuestionAnswers##; DECLARE @QuestionTags NVARCHAR(150) = ##QuestionTag1##; -- SELECT the final results. Data is filtered based -- on the following conditions. -- ClosedDate IS EQUAL TO null -- PostTypeId IS EQUAL TO question -- Score GREATER THAN OR EQUAL TO @MinQuestionVotes -- AnswerCount LESS THAN OR EQUAL TO @MaxQuestionAnswers -- Tags CONTAIN @QuestionTags SELECT Posts.Id AS [Post Link] , OwnerUserId AS [User Link] , Posts.Score , Posts.Tags , Posts.ViewCount , Posts.AnswerCount FROM Posts INNER JOIN PostTags ON Posts.Id = PostTags.PostId INNER JOIN Tags ON PostTags.TagId = Tags.Id WHERE Posts.PostTypeId = 1 AND Posts.ClosedDate IS NULL AND Posts.Score >= @MinQuestionVotes AND Posts.AnswerCount <= @MaxQuestionAnswers AND Tags.TagName LIKE CONCAT('%', @QuestionTags, '%');
Finally, here's an example of possible inputs. When entering into the
QuestionTags field, you need to surround your tags with single quotes, like this:
@MinQuestionVotes: 1 @MaxQuestionAnswers: 0 @QuestionTags: 'python'