31

Just like there is code highlighting for languages when you ask programming questions, can you add a feature where you can enter table design information and it is visually shown in the question?

Right now, we either use ASCII art to represent tables or paste the CREATE statement. ASCII is cumbersome and CREATE statements take a lot of time (at least for me) to understand and visualize.

Wouldn't it be great to have a feature where you can enter table names, fields, types, keys, relations etc. and it shows a DB table diagram so that people who answer can start working on the problem instead of spending half their time understanding the table structures?

5

4 Answers 4

12

See

Is there a web app to create ASCII art tables?

From our very own Senseful!

I just copied and pasted this from SQL Server Management studio:

-1  Community   210
1   Jeff Atwood 5636
2   Geoff Dalgas    148
3   Jarrod Dixon    101
4   Joel Spolsky    959

Into Senseful's web app and got

╔════╦══════════════╦══════╗
║ -1 ║  Community   ║ 210  ║
╠════╬══════════════╬══════╣
║  1 ║ Jeff Atwood  ║ 5636 ║
║  2 ║ Geoff Dalgas ║  148 ║
║  3 ║ Jarrod Dixon ║  101 ║
║  4 ║ Joel Spolsky ║  959 ║
╚════╩══════════════╩══════╝

(I probably should have ticked the "no header" option...)

How to format SQL tables in a Stack Overflow post?

3
  • Looks like the community is staging a breakout of Super Max
    – random
    Jun 26, 2011 at 20:24
  • 1
    I prefer ozh.github.io/ascii-tables for creating tables from plain text
    – user157328
    Feb 22, 2019 at 7:22
  • Except that in a [mre] a table should be initialization code that is laid out in tabular format.
    – philipxy
    Jun 3, 2020 at 7:13
1

You know you could use a query on http://data.stackexchange.com to represent your data structures and link to it. We allow for temp tables and table vars.

3
  • 1
    I am not sure I get it. That link is for querying StackExchange sites right? How do I use it to represent tables from my application when asking a question?
    – user154174
    Mar 6, 2011 at 7:50
  • 4
    overkill alert. besides, if your Joe Public user is smart enough to go to that site and set up temp tables and then a query, I doubt they would be asking that many questions on SO Mar 6, 2011 at 8:25
  • 1
    For performance questions (involving creating tables with millions of rows), you really want people to play on data.SE? How much load can that server take? Ref: meta.stackexchange.com/q/81729/156011 Mar 6, 2011 at 8:28
1

I would like to see a filter that can turn CREATE TABLE statements in the most popular SQL dialects into simple diagrams, but it can be argued that it adds a complex task that should be done by a third party.

It would indeed be a great job for an external service - converting CREATE TABLE statements into images (sub-optimal but nice-looking) or - ASCII art!

1
  • Where is @George Edison? Jun 26, 2011 at 12:28
1

As shown in /editing-help#tables, and announced on 2020-11-23, posts support the GitHub-flavored markdown table extension specification.

The editor has a button that creates a simple table (shortcut: ctrl+E). Sadly, it doesn't currently seem to offer anything for selecting table dimensions.

Here's an example:

you don't
matter give up!

It doesn't have support for showing types, keys, and relations as you are looking for, but I thought this to be worth an answer post, since the answer by Jeff doesn't seem to either.

2
  • I'd almost argue, tho no one has, that tables are the wrong tool for this, and we need a supported ERD diagram tool for this. But that's scope creep, and there's other associated issues. Jan 9, 2023 at 2:44
  • @JourneymanGeek perhaps that comment fits better under the question post, since that applies to what the question is asking for.
    – starball
    Jan 9, 2023 at 2:53

You must log in to answer this question.