Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

This question already has an answer here:

I would like to ask a question on Stack Overflow which includes a table of data from a MySQL database. What is the best way to include a table of data in a question?

share|improve this question

marked as duplicate by Danubian Sailor, Martijn Pieters support May 16 '14 at 12:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 11 down vote accepted

Some people like ASCII Art. Though it's annoying to type in:

| Username  | Password  | Email_Addr |
| Username1 | Password1 | Email 1    |
| Username2 | Password2 | Email 2    |
| Username3 | Password3 | Email 3    |
| Username4 | Password4 | Email 4    |
| Username5 | Password5 | Email 5    |
share|improve this answer
thanks - that's perfect (I guess i was wondering if there was a built-in table function but that works great) – Tomba Feb 3 '10 at 15:55
Just remember to surround the table in <pre> tags. – GEOCHET Feb 3 '10 at 16:01

As someone that answers a lot of SQL questions the best way In my opinion to include a table of data is as follows.

Username varchar(20) PRIMARY KEY,
Password varchar(30),
Email_Addr varchar(100)

SELECT 'Username1','Password1','Email 1' UNION ALL
SELECT 'Username2','Password2','Email 2' UNION ALL
SELECT 'Username3','Password3','Email 3' UNION ALL
SELECT 'Username4','Password4','Email 4' UNION ALL
SELECT 'Username5','Password5','Email 5' 

It gets tedious very quickly adding quotes onto strings, inserting commas and removing vertical bars, underscores and other such artefacts in order to set up a test table to answer the question.

share|improve this answer

If you don't want to create ASCII art you could upload an image. Simply create the table yourself (spreadsheets work well for this) and then upload a screenshot of the table.

# Sample Table Image #

Another route would be to create a table in a google spreadsheet and then use the publish as a web page option to create a link to it.

share|improve this answer
No. This is not a good idea. It just increases the amount of typing that potential answerers have to do. – Martin Smith May 6 '11 at 18:01
While I also appreciate DDL/DML to setup SQL questions and am glad you included that as an answer (+1), sometimes a visual representation would be useful. In particular, users new to SQL may not know how to generate table creation/population SQL. I'd certainly prefer picture of their table over the vague two sentence descriptions I often see. – Leigh Riffel May 6 '11 at 19:37
An image also works for any tabular data whether it is database related or not. – Leigh Riffel May 6 '11 at 19:43
Yes true it's definitely better than a vague sentence! My -1 is locked in now so I can't remove it. Shame the support in the markdown editor is so non existent for tables as discussed in this related feature request – Martin Smith May 6 '11 at 21:58
@Martin, I edited the question. I'm not sure, but I think that means you can up-vote it back to zero. – Leigh Riffel May 9 '11 at 18:49

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