10

After having answered a few SQL related questions over at SO, I'd like to know how you feel about having SQL questions asked. I prefer them to come with create table(...) statements followed by insert into... statements, and I am more likely to answer such a question as opposed if someone tries to describe what is in a table.

Edit: I realize that I wasn't precise with the question: with SQL question I mean questions related to DML operations.

3

4 Answers 4

5

Better to have standard requirements. An abbreviated create table seems vital when dealing with any kind of DDL. We don't need the full table, but we do need the bits that the asker has a problem with.

4

In some cases an alternative to create might be simply to use something like posgres' \d or mysql's describe but I think it really depends on the question, if it's "why doesn't my insert work" then you probably need to include a table definition.

3

I assume you mean create/insert statements to create the tables and data needed to run the query in question. I'd say this is nice to have but not required, at least initially.

If the query is complex and you can't identify the problem just by looking at it then I'd say it's okay to ask for create/insert scripts.

1
  • Yeah that's the question.
    – jcolebrand Mod
    Commented Jan 25, 2011 at 6:34
3

I think that any DDL that's only "supportive" to the question should go at the end of the question, the reason being, so we can focus on the actual question when we first load the page. I'm not saying hide it, I'm just saying focus on the DML if the problem is with DML, or focus on the DDL if the problem is with the DDL.

But regardless, this question really recaptures a common complaint on SO and pretty much all the SOIS/SE sites, which is: "Hey user, would you write a question that really explains the problem rather than asking my genius self to guess what you mean based on years of experience with noobs" ... Yes, we can often guess with the first sentence just what the problem is, but if people would ask the question imagining they were the ones that had to answer the question (so that they considered what details they would need to know to answer the question) then all of SE would be a tad more expeditious in their answers.

You must log in to answer this question.

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