14

Should SQL challenges (performance-related or otherwise) be considered on topic for this site? By "SQL challenge" I mean attempting to solve a problem using SQL that may not have any immediate, real world application. In some cases it could be obvious that SQL is the wrong choice of language for the problem. I think that a strict interpretation of the rules would consider these to be off topic, but I find them to be a fun way to be exposed to new ways of solving problems and to develop technical skills.

To try to better explain what I mean here, I would define a challenge as writing code for the sake of writing code. I know the example questions below weren't closed, but I'm asking for the sake of future questions that might be asked. For example, consider dynamic data masking in SQL Server. I think that asking for queries which can quickly unmask data of a certain type would be an interesting exercise. Do I have a practical need for such an answer? No, I'm not a malicious hacker. Could I create a fake scenario for such a question? Sure, I could say something like "My boss is convinced that dynamic data masking will protect our data. Is it possible to write a very efficient data that unmasks all of the data?" Is that scenario necessary for it to be on topic?

Here are some examples of what I would describe as SQL challenges:

What are different ways to replace ISNULL() in a WHERE clause that uses only literal values?

How can I convert the first 100 million positive integers to strings?

19

Yes, SQL Challenges should be considered on topic because...

  • they provide the community with new approaches to existing problems.

  • they show the more exotic forms of SQL, and are an invaluable way to hone your craft.

  • they are popular and may attract new expert users to the site

  • We love fun

9

Neither.

SQL Challanges (as described in the question) are neither automatically on-topic, nor off-topic.

Each question should be evaluated on its merits by the community.

I would expect questions of this type to be well-received, if they:

  • Fit in Q & A format
  • Are clearly presented and explained
  • Contain sufficient information to identify correct answers
  • Invite answers based on expertise and experience, rather than personal opinion
  • Produce content with long-term value
  • 1
    "Produce content with long-term value" -- well, there go all my answers. – Erik Darling Oct 17 '17 at 11:50
8

No, SQL Challenges should be considered off topic because...

7

No, but continue to allow moderator/community discretion for questions that don't quite fit, but produce sufficiently interesting answers.

Worth noting is that neither question you have linked is closed. A question that starts "What are different ways to…" is a red flag for other reasons, whether it is on-topic or not, which just goes to show that the community is already flexible concerning Q&A with that degree of effort/interest.

The problem with voting "Yes" here is not that this kind of Q&A won't be allowed (it already is in some special cases), but that it turns routine closures of all sorts of silly stuff into a bigger battle. Do we really want a flood of code-golf here?

  • Re: opening para, how long to we leave something open to allow a sufficiently interesting answer to appear? This seems like a bit of a departure from general policy, where questions are generally evaluated on merit and without reference to the answers. – Paul White says GoFundMonica Sep 5 '17 at 13:41
  • 1
    But I agree wholeheartedly about not wanting SQL code golf here! – Paul White says GoFundMonica Sep 5 '17 at 13:47
  • That's a tension intrinsic in the whole 'sifting for pearls' effort, isn't it? – Jack Douglas Sep 5 '17 at 13:58
  • I'm not so sure it is. Sand vs pearls talks about there being an inexhaustible supply of questions - whereas we are looking for great answers. Of course a poor question might lead to a great answer, but more often they come with good (enough) questions. I'm personally of the view that it is OK if we miss the occasional pearl by being rather ruthless with questions. – Paul White says GoFundMonica Sep 5 '17 at 14:11
  • "No, it’s just a mundane grain of sand question that could have been asked by anyone at any time. What makes it remarkable is the incredible answer on that question by Larian LeQuella with over 100 upvotes." — but no-one knew that answer was coming when they were weighing whether to close the question. It's good to keep the bad question count down by closing rubbish early (which is exactly why I don't think we should rush to open a new floodgate), but answers to reveal whether a question is worth keeping sometimes – Jack Douglas Sep 5 '17 at 14:48
  • Right, and if the question had been closed, who's to say the answerer wouldn't have written an equally super answer somewhere else, or even self-answered their own (better written) question. – Paul White says GoFundMonica Sep 5 '17 at 17:36
  • By "code golf" do you mean writing a query such that it has a low count of characters? That wasn't what I had in mind at all. I don't see why allowing one class of question implies the other. Also, where would this flood of code golf questions come from? Who wants to ask them? There's exactly one question with a tag of "sql" on the code golf stack exchange. – Joe Obbish Sep 6 '17 at 5:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .