14

I am referring to the differences in the FAQ question "How do I ask a good question?" I just saw someone reference the SO version of this FAQ in a question on DBA.SE.

I don't know how the FAQ links get updated or who writes them, but the breadth of information in the SO version is much more appealing to me and portrays a better format to help a user. I don't know if it is proper etiquette to copy the SO over to DBA.SE so we could reference that within DBA.SE.

So I guess the question is can this topic be rewritten with more detail similar to SO's version?

2

3 Answers 3

10

Finally get back around to this...This is just expanding on what is already within the Help Center > Asking itself.

How do I ask a good question?

We'd love to help you. To improve your chances of getting an answer, here are some tips:

A Title is the first thing they will see

The title of a question is going to be what draws folks to your question. Think about it as if you were passing someone on the escalators, or a short elevator ride. Your title should be a one sentence statement that is short and to the point. You would then expand on that in the body of your question.

Search, and research

[the term "search" is a link currently but it does not let me duplicate that in this format] Have you thoroughly searched for an answer before asking your question? Sharing your research helps everyone. Tell us what you found and why it didn't meet your needs. This demonstrates that you've taken the time to try to help yourself, it saves us from reiterating obvious answers, and above all, it helps you get a more specific and relevant answer!

Be on-topic

Our community is defined by a specific set of topics that you can view in the help center; please stick to those topics and avoid asking for opinions or open-ended discussion. If your question is about the site itself, ask on our meta-discussion site. If you’re looking for a different topic, it might be covered on another Stack Exchange site.

Tags, tags, tags

If you are going to ask question(s) about specific RDBMS one additional thing you can do to help steer like minded folks to your question is with tags. If you are asking something about SQL Server or MySQL then you can use the tags sql-server or mysql respectively. The same goes if you are dealing with certain versions of an RDBMS such as oracle-11g-r2 or sql-server-2008. Tags are just another thing that can garner the appropriate attention for those professionals that deal with the particular RDBMS you are needing help with.

Be specific

If you ask a vague question, you’ll get a vague answer. But if you give us details and context, we can provide a useful answer.

Make it relevant to others

We like to help as many people at a time as we can. Make it clear how your question is relevant to more people than just you, and more of us will be interested in your question and willing to look into it.

Keep an open mind

The answer to your question may not always be the one you wanted, but that doesn’t mean it is wrong. A conclusive answer isn’t always possible. When in doubt, ask people to cite their sources, or to explain how/where they learned something. Even if we don’t agree with you, or tell you exactly what you wanted to hear, remember: we’re just trying to help.

A few examples

Below are just a few examples of well thought out and written questions. Please take note of the title used, the body of the questions were to the point and provide sufficient amount of information, and are tagged appropriately:

How do I list all databases and tables using psql?

About single threaded versus multithreaded databases performance

Why shouldn't we allow NULLs?

2
  • I often see questions which would benefit from an actual execution plan (or the database platform equivalent). Is there a way to incorporate into questions tagged eg [t-sql] and [query performance] a prompt to include an actual execution plan (not a screenprint) with instructions on how to do it? Along with a made-up stat like "..questions with actual execution plans are 90% more likely to get a good answer quickly." <<-- it's like online dating, profiles with photo ...
    – wBob
    Dec 28, 2016 at 13:05
  • 1
    @wBob I would say find a question that is formatted correctly, maybe ones that contain specific for each platform, and we include that in the examples. If we do find one for each RDBMS we can break the examples up by each one. I am not aware of any ability to tie prompts to the tagging of a question, but the mods would have to answer.
    – user507
    Dec 28, 2016 at 19:29
5

Good question. On the DBA version I don't see any mod-link for editing the text, so I'm guessing it needs to be edited by someone from SE.

Perhaps you should knock up a proposed page in an answer here and we'll ask them to action it?

0
3

This answer is community wiki please provide additional database-specific information at the bottom.

Formatting

When possible do not include screenshots or pictures where text would otherwise do, and even better than text is the necessary SQL to build a test case. If you have the skills to provide test data in a textual grid and in SQL that would be best. For instance, if you're showing 3 rows of test data you could provide the CREATE TABLE AS SELECT to go along with it.

CREATE TABLE foo
AS
  SELECT id, char
  FROM ( VALUES
    (5,'a'),
    (6,'z'),
    (7,'d')
  ) AS t(id,char);

Or even more simply,

CREATE TABLE foo(id,char)
AS VALUES
  (5,'a'),
  (6,'z'),
  (7,'d')
;

This can also be spaced out to and whitespace-aligned.

CREATE TABLE foo AS
SELECT *
FROM ( VALUES
  (5, 'col2',   'foo'),
  (6, 'foobar', 'bar'),
  (7, 'baz',    'baz')
) AS t(id,fooCol,barCol);

PostgreSQL

On Unix, if you have a table with test data you can dump it with,

## We remove comments, and VARIABLE sets
pg_dump -t myTable -d myDatabase -O --inserts | sed -e'/^\(SET\|-\)\|^$/d'

Transact SQL

-- A Table variable will probably be good enough for most cases
DECLARE @TestData TABLE(foo INT, bar NVARCHAR(50));

-- A full table can also be created.
CREATE TABLE TestData(foo INT, bar NVARCHAR(50));

-- Insert data into the table or table variable
INSERT INTO @TestData (foo, bar)
VALUES (1, N'Fizz'), (2, N'Buzz');

You must log in to answer this question.