To preface this post a little bit, I'll explain a little bit of the "backstory" here. The Stack Exchange site, Gaming.SE, also known as Arqade, often has a large influx of bad questions about the popular video game, Minecraft. Many of these questions are either easy to find on a search engine, horribly unclear, have been asked before, are treating Arqade like a forum, or are asking for things like account support, which only the company that produces the game can provide. A few examples might include:
The query essentially searches in a manner like this:
- It looks for questions with tags that are like
%minecraft%
or%minecraft-%%
. - It checks to see if it has a score below -1.
- It checks to make sure that the post hasn't already been deleted.
- It checks to see if it's either been closed, or not closed.
I'd like to know the following things:
- Is there a way to make this shorter and less repetitive?
- Are there any redundant checks that aren't needed?
- Are there any checks that could cause problems?
- Anything else?
Here's the code, and the query link:
SELECT
Id AS [Post Link]
, OwnerUserId AS [User Link]
, Score
FROM Posts WHERE
DeletionDate IS NULL
AND Score <= -1
AND (
Tags LIKE '%minecraft-%%'
OR Tags LIKE '%minecraft%'
)
AND (
ClosedDate IS NULL
OR ClosedDate IS NOT NULL
);
SELECT
COUNT(*)
FROM Posts WHERE
DeletionDate IS NULL
AND Score <= -1
AND (
Tags LIKE '%minecraft-%%'
OR Tags LIKE '%minecraft%'
)
AND (
ClosedDate IS NULL
OR ClosedDate IS NOT NULL
);