56

SQLFiddle has been an essential tool and a great complement to dba.se for a very long time, but it has gone downhill a bit in the last year or two.

I have also wondered for some time what a 'fiddle' designed specifically with dba.se and markdown in mind might look like, and over the last few days I've put together a prototype of how I think it should be.

Please have a play with the site and let me know here if you have suggestions for improvements or design changes.

The current list of supported databases is:

  • Db2 Developer-C 11.1 (with lots of thanks to @mustaccio)
  • MariaDB 10.2 and 10.3
  • MySQL 8.0
  • Oracle 11.2 & 18
  • Postgres 8.4, 9.4, 9.5, 9.6, 10 and 11
  • SQL Server 2012, 2014, 2016, 2017 and 2017 Linux (but Windows versions are currently offline for licensing reasons)
  • SQLite 3.8 and 3.16 (but 3.16 is currently offline for security reasons)

Here's an example (the image links to the fiddle):

  • enter image description here

I've edited some of my answers (e.g. this one) to use db<>fiddle.

As of Apr 2018 the site uses ssl by default — there are some benefits even for a site like db<>fiddle and it's free now so why not?

  • 11
    +1, +10, +1000000000000000000 – ypercubeᵀᴹ Feb 16 '17 at 18:28
  • 5
    ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ – MDCCL Feb 16 '17 at 21:14
  • 2
    +2 also. It would be a welcome addition. As wishes are cheap: having several versions (i.e.: PostgreSQL 9.4, 9.5, 9.6...) of the same DB would be a plus. Sometimes you don't know when your problem is just version specific... and you'd better upgrate quickly. – joanolo Feb 19 '17 at 6:38
  • 2
    @joanolo "As wishes are cheap" not at all, thanks for the suggestion. I've added 9.5 and 9.4, and will add others at some point! – Jack Douglas Feb 19 '17 at 18:16
  • 4
    As sqlfiddle is an established site, and you seem to have already invested time and effort in to it according to the about page, couldn't SE just adopt it and make sql fiddle great again, by pushing some resources towards it's development? – Tanner Feb 21 '17 at 10:34
  • 2
    @Tanner when I saw the writing on the wall a couple of years ago, I asked that question, but although help was offered, it wasn't the sort that Jake needed. – Jack Douglas Feb 21 '17 at 10:37
  • @JackDouglas fair enough, just thought I'd ask... you know, reinventing the wheel n all. good luck, would be interested to see how it develops. – Tanner Feb 21 '17 at 10:54
  • 2
    @Tanner thanks, feel free to post feature requests here if you have ideas. – Jack Douglas Feb 21 '17 at 11:10
  • Forgive my ignorance, but what are SQLfiddle/DBFiddle? I followed the links but they didn't have any explanatory text. I also couldn't find any reference on DBA.SE about them. – BradC Feb 23 '17 at 16:37
  • @BradC Try this one: dbfiddle.uk/… the point is that you can make a reproducible test case demonstrating a question or problem, and then others can tinker with it (try changing the sql in the link in this comment) – Jack Douglas Feb 23 '17 at 17:12
  • 1
    @JackDouglas: Others who don't have the target dbms installed can tinker. That's the big deal for me. I'd usually rather see the SQL in the question, myself. There's no reason people can't include SQL in the question and in a fiddle, but that's not as common as I would like it to be. – Mike Sherrill 'Cat Recall' Feb 28 '17 at 16:49
  • 4
    The site has evolved. By now, in all modesty, I'd like to say it's absolutely marvellous. – Erwin Brandstetter Apr 10 '17 at 1:18
  • 1
    @lad2025 thanks for spotting that bug, now fixed. Regarding db support, pg11 will be added soon, but Oracle 12c probably never as there is no XE version. 18c XE is thought to be coming up (possibly in July) and if that materializes I will add it. – Jack Douglas May 28 '18 at 8:36
  • 1
    @Mitch both dbfiddle and my church are intended to help people, and both are the product of a lot of effort. I don't push either on anyone — and I hope to have the same respect shown to me by those who believe differently. – Jack Douglas May 30 '18 at 9:39
  • 1
    @JackDouglas I can build a Linux VM with Db2 for you -- any particular requirements for the VM? What hypervisor? – mustaccio Mar 5 at 16:44

32 Answers 32

0

Would it be possible to show multiple outputs in one SQL field? At the moment if you have two SELECT statements only one will be shown in the results. https://dbfiddle.uk/?rdbms=postgres_9.6&fiddle=c17a17e3a448a08adc851b21d0bea5d2

For my Postgres answers I like to do these steps: CREATE TABLE, INSERT data and SELECT * FROM new_table to show how the origin table and its content look like. For multiple tables I have to use two section only for the SELECT part.

It's nothing critical, I know. But it would be nice candy I think!

  • I'm afraid I don't think that's an easy thing to do with the postgres PHP driver we are using. It works fine with SQL Server: dbfiddle.uk/…. You can split the batch automatically with one of the icons inside the hamburger on the right but I'm not sure that is what you want. – Jack Douglas Oct 31 '18 at 14:43
0

I am missing the possibility to copy the table results for the SO editor. If I simply copy the table I end up with things like that:

user_id     check_date  day     time_in     time_out    hours   status
53  2018-07-16 00:00:00+01  Monday      08:15:17    09:38:03    25.3794444444444    present
53  2018-07-17 00:00:00+01  Tuesday                 absent
53  2018-07-18 00:00:00+01  Wednesday   06:34:13    08:05:17    1.51777777777778    present

The columns and values are not really aligned together. So I always have to append a manual formatting step (e.g. converting tabs into spaces):

user_id   check_date               day         time_in    time_out   hours              status
53        2018-07-16 00:00:00+01   Monday      08:15:17   09:38:03   25.3794444444444   present
53        2018-07-17 00:00:00+01   Tuesday                                              absent
53        2018-07-18 00:00:00+01   Wednesday   06:34:13   08:05:17   1.51777777777778   present

In SQLFiddle you can chose the output between (table, plaintext, markdown). Even plaintext looks much better and can be taken for copying into SO without any addional work:

| user_id |           check_date |       day |  time_in | time_out |                hours |  status |
|---------|----------------------|-----------|----------|----------|----------------------|---------|
|      53 | 2018-07-16T00:00:00Z | Monday    | 08:15:17 | 09:38:03 |   25.379444444444445 | present |
|      53 | 2018-07-17T00:00:00Z | Tuesday   |   (null) |   (null) |               (null) |  absent |
|      53 | 2018-07-18T00:00:00Z | Wednesday | 06:34:13 | 08:05:17 |   1.5177777777777777 | present |

Edit: dbfiddle markdown syntax

> user_id | check_date             | day       | time_in  | time_out | hours               | status 
> ------: | :--------------------- | :-------- | :------- | :------- | :------------------ | :------
>      53 | 2018-07-16 00:00:00+01 | Monday    | 08:15:17 | 09:38:03 | 25.3794444444444    | present
>      53 | 2018-07-17 00:00:00+01 | Tuesday   | <em>null</em>     | <em>null</em>     | <em>null</em>                | absent 
>      53 | 2018-07-18 00:00:00+01 | Wednesday | 06:34:13 | 08:05:17 | 1.51777777777778    | present

As you can see, the second row is not really aligned. Furthermore you can find the <em> tags and things like that.


Added by Jack:

select 1, null;
?column? | ?column?
-------: | :-------
       1 | null    
  • have you tried the 'markdown' link at the top? – Jack Douglas Oct 31 '18 at 14:41
  • Yes, of course. But it creates markdown syntax which is not a really good result (appending example) – S-Man Oct 31 '18 at 14:45
  • The <em> tag is the only one — and it's there to distinguish between "null" (the string) and an actual null result. I guess it would be nice if the alignment took that into account, but does it really matter for SO? Also, when I paste in the markdown directly from db<>fiddle to an SO answer it doesn't look like yours: I'll edit an example into your question. – Jack Douglas Oct 31 '18 at 15:12
  • Yours is indented and missing the <pre> tags – Jack Douglas Oct 31 '18 at 15:14
  • 1
    @JackDouglas Thanks for you great tool. But I still miss the feature of a plain text output. I have different use cases where I need a good text style as in the psql console. The only fiddle engine that has it integrated is SQL Fiddle (as shown above). I really don't need markdown, just simple table lines. That's one of the last reasons when I have to use SQL Fiddle instead of your great tool. I would be really appreciated and it would really really help me a lot if you could integrate such an output option as well. SQL Fiddle also offers the 3 versions. – S-Man Jan 20 at 9:08

You must log in to answer this question.

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