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:

  • MariaDB 10.2
  • MySQL 8.0
  • Oracle 11.2
  • Postgres 8.4, 9.4, 9.5, 9.6 and 10
  • SQL Server 2012, 2014, 2016, 2017 and 2017 Linux
  • SQLite 3.8

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

  • enter image description here

I've edited some of my answers (eg 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 an 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
  • @BradC also, there is a bit of documentation on the home page for each RDBMS: dbfiddle.uk/?rdbms=sqlserver_next – Jack Douglas Feb 23 '17 at 17:13
  • 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
  • @Mike we can't force that (except by editing posts), but yes, all the SQL should go in the Q&A as well as the fiddle. I've tried to make this as easy as possible with the 'markdown' link next to the 'run' button — I only added this yesterday so you may not have seen it? – Jack Douglas Feb 28 '17 at 16:53
  • 2
    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 at 8:36

15 Answers 15

Thank you for this. I have been using rextester for this, but it doesn't work properly for Oracle.

I don't like the tiny input field to start with. I would prefer it to be presented as a much wider (and higher) text field so that it's immediately clear that you can input more then just a few characters.

It also doesn't auto-expand for subsequent statements (using Firefox on Windows 10). After pressing the + the input field stays at the initial size. You can input larger statements but you can't see them properly.

I know parsing SQL is hard, but having to click the + button for each new statement is a bit cumbersome.

Also, if anyone wants to talk me through installing SQL Server 2016 on Debian without a GUI, I'm all ears

What about: https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-docker

  • 1
    "It also doesn't auto-expand for subsequent statements" thanks, fixed! I've tinkered with the home page a bit which may make it a bit clearer (please tell me if you think it doesn't). I don't want to parse the SQL at all if possible — I've toyed with the option of allowing a separator or magic character to be specified as a delimiter — maybe with a 'paste script' button. – Jack Douglas Feb 18 '17 at 19:05
  • I think you can install on Debian (perhaps 'testing', that's fine) — I did find half a HOWTO but it wasn't detailed enough. That link seems to be about Docker in particular which isn't what I'm after. – Jack Douglas Feb 18 '17 at 19:14
  • @JackDouglas: there is an installation procedure for Ubuntu: docs.microsoft.com/en-gb/sql/linux/… – a_horse_with_no_name Feb 19 '17 at 20:00
  • That's much more like it :) chat.stackexchange.com/transcript/message/35541418#35541418 – Jack Douglas Feb 19 '17 at 20:23
  • 2
    "having to click the + button for each new statement is a bit cumbersome" you no longer have to do this if you are pasting in a whole script into an empty field — DBFiddle will split on ';' (or GO for SQL Server). – Jack Douglas Feb 20 '17 at 22:22

Just as a suggestion:

For me syntax coloring would be appreciated.

And some short-key to execute instead of click on RUN button.

And I don't know if it is a vNext feature, but dates fields are shown using this long format:

 Jan  1 2017 12:00:00:000AM
  • Thank you, great suggestions. No idea about the dates except that it's probably British defaults? – Jack Douglas Feb 22 '17 at 21:47
  • @JackDouglas It is similar to style=9 of CONVERT command. dbfiddle.uk/… – McNets Feb 22 '17 at 21:50
  • "And some short-key to execute instead of click on RUN button." 'r' now has the "accesskey" attribute so you can press it with ALT+r (or whatever — it depends on your browser and platform). Unfortunately it doesn't work while editing a textarea — you need to lose the focus first. in practice that means press TAB then hit ALT+r which works OK. – Jack Douglas Feb 24 '17 at 9:49
  • Ok @JackDouglas Thanks. – McNets Feb 24 '17 at 9:51
  • I've used Ace for syntax highlighting — can you let me know if you like it? Not sure whether to keep the line numbering or not. – Jack Douglas Feb 24 '17 at 16:49
  • @JackDouglas it's fantastic! good job. Line numbering is useful if the error message may report the line causing the error. – McNets Feb 24 '17 at 16:53
  • 1
    Good point about line numbering, it's useful here: dbfiddle.uk/… – Jack Douglas Feb 24 '17 at 20:25
  • Could you tell me why this is failing? The SQL couldn't be simpler - I just get 'invalid character' for some reason? I thought it might have been a copy and paste artefact, but not so - I typed it in manually. Puzzling! – Vérace Nov 5 '17 at 11:46
  • @Vérace try it on this way: dbfiddle.uk/… – McNets Nov 6 '17 at 7:44
  • Is that not a bug? I mean, to have to individually put in each record? – Vérace Nov 6 '17 at 11:45
  • @Vérace I think so (for Oracle), but you should ask to Jack Douglas – McNets Nov 6 '17 at 11:46
  • @Vérace It's difficult to make Oracle work the way some other DBs work in this scenario, because the Oracle driver doesn't do the work for me, meaning I would have to parse the SQL (something I am very keen to avoid doing). There are workarounds though, such as this: dbfiddle.uk/… – Jack Douglas Apr 18 at 13:41
  • also you can click on the 'split' link to spilt a field on the default delimiter, which is a shortcut to this quickly: dbfiddle.uk/… – Jack Douglas Apr 18 at 13:42
  • Thanks for that - I'll take another tour - I've been using a rival site with a name not too different from yours :-) I'll keep you posted! – Vérace Apr 18 at 14:36

Excellent work, but I don't care much for the logo. I'm not an artist, but here's a stab at something reminiscent of what you have. If you don't like it, that's fine, but please find something else.



  • Thanks very much Leigh — I'd been thinking about changing the logo to <> (as in "db<>fiddle"), but maybe this instead. – Jack Douglas Feb 28 '17 at 16:44
  • Maybe I don't get it. What are you trying to say with db<>fiddle? "Database not equal Fiddle" or something like "Don't fiddle with the database"? Or is it just a symbol to separate db from fiddle? – Leigh Riffel Feb 28 '17 at 16:49
  • 2
    "is it just a symbol to separate db from fiddle" yes, it's just a database-related symbol to separate db from fiddle. Also a (subtle?) joke about programmers v DBAs. – Jack Douglas Feb 28 '17 at 16:56
  • Then maybe you just want a stylized <>. I have one, but the image upload tool doesn't seem to accept it right now. – Leigh Riffel Feb 28 '17 at 21:11
  • That's probably due to the Amazon S3 outage: theregister.co.uk/2017/03/01/aws_s3_outage – Jack Douglas Mar 1 '17 at 7:51
  • @JackDouglas Indeed, works now. – Leigh Riffel Mar 1 '17 at 13:46
  • thanks for that too :) – Jack Douglas Mar 1 '17 at 13:55

A few comments after superficial testing:


Thank you for the site. It's generally great!


Are you ok with links posted on other SO sites or anywhere in the web? Example on SO, where I just updated an existing answer with it:

Not sure how you would stop people from doing that, but you can stop me.


I have used the generic text "SQL Fiddle" to link to (mostly) sqlfiddle.com in the past. Do you think it's appropriate to use the same text for links to your site or do you prefer "dbfiddle" like you have it in the markup. Maybe more useful for the general public, to see where the link is going right away?


There might be an option to remove an additional SQL window (except for the first one). Currently we can only add more, but there is no way back. The Plus + might flip to -. Also there might be a clear per SQL window (additionally), not just for the whole page.


I like the spartan, no-nonsense design.

  • Result fields might have a tiny bit more spacing. That's what I see in Firefox 51.0.1:

dbfiddle results


I like that we can have any number of queries with results.

  • It might be useful to have an option to (re-)execute only one of them. i.e. a button like run this below each SQL window in addition to the general run at the end. Might require more webdesign smarts to update only the selected section (I am no expert with this.).

    While the next SQL window can depend on results from the previous one, that does not have to be the case (like in my example above).

    Alternatively (additionally), run so far could be useful.


I like that we have Postgres versions 9.4, 9.5 and 9.6 at our disposal. SQL Fiddle didn't keep up.


I like the markdown feature, which produces this (example from link above):

-- empty string equals any string of spaces when cast to char(n)
SELECT ''::char(5) = ''::char(5)     AS eq1
      ,''::char(5) = '  '::char(5)   AS eq2
      ,''::char(5) = '    '::char(5) AS eq3;

|t  |t  |t  |
  • What do you (or others) think about this alternative format for results?

eq1 | eq2 | eq3
t   | t   | t

Less noise, more spacing. It's the default format in psql, with "quoted code" markdown. (Meta has no syntax highlighting, effects are better viewed on the main site.)


On-site disclosure / statements on site owner, intended use, license, update policy, expected lifetime, public visibility, privacy?

I know, it's still beta. Just mentioning it.

  • Thanks for the encouragement Erwin — If you find dbfiddle useful then I must be getting something right. ① anywhere in the web is fine :) ② I'd prefer "dbfiddle" — though you could use the generic "fiddle". "SQL Fiddle" is (It think) Jake's trademark so should probably only be used for his site. ④ you mean the output tables or something else? A screengrab might help with this. ⑤ iiuc that won't be possible — the whole script is run as a unit and in general a SELECT is going to depend on the INSERT before it. There is a keyboard shortcut for the "run" button though. … – Jack Douglas Mar 6 '17 at 17:32
  • ⑦ I like your alternative format, and the markdown could be adjusted to look a bit more like that, but while there is still some hope that we will eventually get markdown tables on dba.se, I think it would be good to use valid markdown. ⑧ yes to all of that, and also all the source code is going up on GitHub at some point. Top of my todo list is getting some more backends added (SQL Server 2014, 2012, MySQL whatever), but the rest isn't too far down… – Jack Douglas Mar 6 '17 at 17:36
  • @JackDouglas: I updated ④ & ⑤, and added the missing ③. – Erwin Brandstetter Mar 6 '17 at 18:15
  • I wondered about ③ :) definitely a good suggestion, I've been lazy so far because there is a secret way to get rid of fields: just leave them blank. Then they are removed when you press "run" — hardly intuitive though. ④ I've increased the left and right padding by 1px, and made the table borders grey instead of black, have I gone far enough with the padding do you think? ⑤ OK I get what you mean — but at the moment I'm unsure if that would be worth the extra complexity. – Jack Douglas Mar 6 '17 at 18:56
  • 1
    ④ works great for me now. Generally: all just ideas. The site is already a win. Most importantly, it works, and pretty quickly, too, so far. – Erwin Brandstetter Mar 6 '17 at 22:43
  • 1
    ③ I've added 'clear' and 'remove' links to each field, does that seem like a good solution? – Jack Douglas Mar 13 '17 at 17:49
  • Awesome. A flipped button [-] might be ambiguous as to which field is removed. Your implementation avoids the problem. – Erwin Brandstetter Mar 13 '17 at 18:04
  • 1
    ⑦ I've tweaked the markdown output to add spaces left and right — as per the Markdown Extra spec: michelf.ca/projects/php-markdown/extra/#table. By default it now only adds leading and trailing pipes for 1-column tables. I think the extra spacing is much nicer, but I'm not sure whether removing the pipes is an improvement, can you let me know your opinion? dbfiddle.uk/… – Jack Douglas Mar 14 '17 at 14:44
  • @JackDouglas: I like both (more spacing, less unnecessary pipes) better than before. But I like the psql style still better, yet. – Erwin Brandstetter Mar 16 '17 at 2:19
  • I'm glad you think that's an improvement — it now exactly matches the SO documentation table markdown so I think I'd better stick with it. Several people have asked about the comments — the purpose is purely so the tables don't get syntax highlighting. I could get a similar effect with <!-- language: none --> and <!-- language: lang-sql --> before/after the result but not without splitting the code block. What do you think is best? – Jack Douglas Mar 16 '17 at 8:17
  • 1
    tangentially related to ⑧, the PHP source for the postgres backends is now up on GitHub: github.com/jackdouglas/dbfiddle/blob/master/backend/… – Jack Douglas Mar 31 '17 at 17:50

I tried the Msft SQL Server vNext option by copying this SQL Statements to create tables and data into the first field and a working solution into the second field. You can see the result in my dbafiddle.uk.

It it unclear to me what i would have to do next, to see a result? Some error message or some indication that the tables are created would be helpfull.

Update after comment that it runs now

The html structure is currently this sequence of html tags <input><textarea /><textarea />. It seems that the first textarea is used for the user to input data and the second is used to output a result for instance a .

  • It would be helpful to see the result next to each first textarea as either a statement (tables created) or a preview of the table strcuture (see example below). In my dbfiddle above only that the second group of (<input><texta /><texta />) had an output

  • I noticed that the output of my first dbfiddle was a little off (to many white space). So I forked the above dbfiddle to confirm that the cause was the RoomName [nchar](120) inside CREATE TABLE [dbo].[Rooms]... This made me aware that a fork button and a field to comment what was changed in the fork could be useful. Linking the forked fiddles could be useful as well. Another option would be to stripe (remove whitespace) of the output columns (although this might be undesired in some cases).

Example: Add a table definition output for each create table-statement next to the matching textarea field like this.

| column name | type        |
| id          | PRIMARY KEY |
| start_time  | TIMESTAMP   |
| name        | VARCHAR     |
  • I don't know why, but if you separate the INSERT statements from the CREATE TABLE statements things look more healthy: dbfiddle.uk/… – Jack Douglas Feb 20 '17 at 20:59
  • It seems execute(@PivotBase) is still ignored. Was my feedback usefull? – threeFourOneSixOneThree Feb 21 '17 at 9:53
  • Yes, useful feedback, thanks! what should execute(@PivotBase) return? My SQL Server knowledge is somewhat limited :) – Jack Douglas Feb 21 '17 at 10:28
  • @PivotBase contains an sql statement and execute is used to executes this sql statement. – threeFourOneSixOneThree Feb 21 '17 at 15:43
  • I needed to widen the permissions — it runs now, thanks – Jack Douglas Feb 21 '17 at 16:05
  • I updated my answer to suggest a preview for each table created next to the matching textarea field. – threeFourOneSixOneThree Feb 23 '17 at 4:09
  • "…either a statement (tables created) or…" in this case I prefer the former — we do need to show the 'table created' (or 'x rows inserted' or whatever) notice. That's next on my list after SQL Server 2016 – Jack Douglas Feb 23 '17 at 8:10
  • re forking, every press of the 'run' button creates a fork, but as you say, there is no way of linking forks to the previous fiddle. I'm not sure that's something I'd be looking to add as it probably belongs in the write-up (blog or post on dba.se or whatever) – Jack Douglas Feb 23 '17 at 8:10

The only thing I need is the Text To DDL function from sqlfiddle:

enter image description here

Of course I can create the DDL in sqlfiddle and copy to dbfiddle. But would be nice having that function included.

Thanks for making this tool! I tried to break the site. Hopefully some of this is useful feedback.


Any chance of getting Oracle 12c? 11g is pretty old at this point although I think Oracle recently extended support for it.


It looks like SQL Server 2014 is pretty close to RTM. If possible can you patch it, at least to SP2?

Testing on SQL Server 2016:


Can we get a bit more info in the erorr messages? Here's what I get in SSMS for the following query:

SELECT 1 / 0

Msg 8134, Level 16, State 1, Line 1

Divide by zero error encountered.

Here is what I get on the site:

Line 1: Divide by zero error encountered.

The following queries all return the "22P02ERROR: invalid input syntax for type json DETAIL: The input string ended unexpectedly. CONTEXT: JSON data, line 1:" error message:


Any query that selects a VARBINARY value such as this one:



This code takes a really long time to execute before failing (I would expect a timeout but if it generates too much data before doing so that's fine):

WHILE @i < 100
    SELECT REPLICATE('Z', 8000);


use tempdb;


use msdb;


use master;



@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, 
@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str,
@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str,
@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str,
@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str,
@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str,
@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str,
@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str,
@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str,
@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str,
@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str,
@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str,
@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str,
@str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str, @str;


Is there an easy way to make this one display more than just seconds? It is precise to more than just seconds (as opposed to GETDATE()):


Oracle - DBMS_OUTPUT.PUT_LINE does not print anything and SET SERVEROUTPUT ON is not working. enter image description here

It would be really useful to test PL/SQL programs. Is there any other way to see this output, other than creating a function and seeing output from a select?

  • 3
    I've been meaning to add this for a while, thanks for prompting me. How about like this: dbfiddle.uk/… – Jack Douglas May 26 at 12:42
  • 1
    @JackDouglas : Wow! You fixed it so quick.. Thanks a lot. That greatly helps. – Kaushik Nayak May 26 at 12:49
  • 1
    glad to help — please consider following the oracle tags on dba.se I'm sure you could answer some of the questions here! – Jack Douglas May 26 at 12:59

Here is an advanced attempt, trying to create and use a function:


42883ERROR:  function f_tmp_groups() does not exist
LINE 1: SELECT * FROM  f_tmp_groups();

Not sure why this happens. A simple SQL function works:


And a basic set-returning plpgsql function works, too:


After separating CREATE TABLE and INSERT statements, the first example works:


I am confused at this point.

Aside: format of error msg ...

  • The first field had two statements in it, this works: dbfiddle.uk/… — obviously the error messages are a big fail at the moment! – Jack Douglas Mar 7 '17 at 16:40
  • @JackDouglas:That's what I found, too (last link). So it's strictly 1 statement per SQL window? – Erwin Brandstetter Mar 7 '17 at 16:44
  • sorry — I obviously didn't read right to the end. Yes, it's currently 1 statement per field — and I thought it had to be that (without me parsing the SQL). Oracle is definitely one statement per field, and SQL Server allow multiple (it's one batch per field), I assumed pg would be the same as Oracle, but… – Jack Douglas Mar 7 '17 at 16:48
  • …looking at the api docs I may have misunderstood that and might be able to change it so you can have multiple statements/results per field — I'll look into it! – Jack Douglas Mar 7 '17 at 16:49
  • 1 statement per field is fine with me. Just didn't know, yet. (Avoids complications.) Not sure how you implemented the execution. You probably only get the results of the last statement. – Erwin Brandstetter Mar 7 '17 at 16:53
  • 1
    Thanks for reporting this. I've no way of enforcing 1 statement per field so I've changed the backend to handle multiple statements — it's a bit quirky though — only the first result set is returned (and I can't change that), so I expect that users will typically stick to one statement per field, but the important thing is that it now behaves as sane as it can and gives more sensible messages. Your original link now works just fine. – Jack Douglas Mar 7 '17 at 19:27

Small Screens Hide Vital Controls (eg "Run")

enter image description here

The images above are from a Samsung S5 using Chrome, not the largest phone screen, but also not the smallest. In landscape mode one can "just" access the Run button, but this is not possible in portrait orientation at all. While I accept that writing SQL on a phone is tedious in the extreme (well I find it is) many people do read Q/A information on such screens.

"Split" is not an intuitive feature:

It took me a few attempts to understand what "Split" does (divides a block of DDL/DML/SQL into individual parts on screen). This is unique to your user interface as far I can tell and certainly not a normal part of SQL. It also appears to be essential to your UI.

I didn't find this initiative at all. Personally it seems of equal importance - and a prerequisite - to "Run" so why isn't it just embedded into the run logic? (and/or placed to the left of run in the top menu?)

Finding the URL

It took me a little while to realize that I needed to use Markdown to locate a URL which would allow me to return to the fiddle.

Removing the 9 unwanted "boxes" to produce "My Fiddle"

If I open https://dbfiddle.uk by default you display multiple "splits" which are aimed at helping "me-the-dumb-user" to understand how it works. Perhaps I'm wrong, but if I want a markdown output that is exclusively related to my own fiddle, I first need to remove these "help splits". That's 9 or so remove clicks to reach a "clean start".

While help is useful for the first-time user, it's tedious for an experienced user. Why not just provide a Help link in the toolbar which displays "help"? The default screen would in that case be almost blank and ready for a new fiddle to be created with no need to hit remove multiple times.

Off-topic content

While faith may be an important topic to some, does it really warrant promotion from a technical help site?

  • 1
    Just wanted to say thank you for providing an a place for sql related fiddles. Perhaps you might also consider DB2 amongst your db list? (it works on Debian it seems: en.wikipedia.org/wiki/IBM_DB2_Express-C) – used_by_already Jun 13 '17 at 6:52
  • Mmmm just found that in the top menu I can "Clear" all the unwanted "splits" with a single click which is good. I would still prefer to work the other way, have the default screen "Clear" and add "Help" if requested. – used_by_already Jun 13 '17 at 7:02

Awesome work!

Looks like it would be handy for some of the answers I've been posting to https://codegolf.stackexchange.com/, and what would be super helpful would be to have a byte counter somewhere underneath each code box, since most of the contests are scored by size.

I'll put this in as an "answer" and maybe consolidate my "bugreports" here.

I was answering this question, so I used your tool to construct the fiddle. It's a question about SQLite.

Here is the fiddle that answered the first part of the question - an UPDATE.

To answer part two, I tried this. As you can see, it fails. I'm quite persistent, so I tried db-fiddle (your arch-rival? :-) ) here and it works nicely.

Any thoughts?

  • I think you need 'BEGIN;' (or 'BEGIN TRANSACTION;') not 'BEGIN' for SQLite (tutorialspoint.com/sqlite/sqlite_transactions.htm) this seems to work: dbfiddle.uk/… – Jack Douglas May 10 at 15:24
  • and I notice you are actually using 'BEGIN TRANSACTION;' on (the other) db-fiddle – Jack Douglas May 10 at 15:25
  • Fraid not :-) Your transaction fails silently - I did try both options! At the bottom, SELECT * FROM master should be sell, sell, not buy, buy and there's no sign of SELECT * FROM scheduled. Also, the db-fiddle works with both BEGIN and BEGIN TRANSACTION. – Vérace May 10 at 16:03
  • ah, OK, I will look into that! – Jack Douglas May 10 at 16:15
  • The SQLlite driver doesn't allow multiple statements in each block, even if they are a single transaction, if you split them out does this do what you'd expect dbfiddle.uk/…? I think this fiddle shows a transaction working as expected: dbfiddle.uk/… – Jack Douglas May 14 at 13:11

No CREATE TYPE privilege under Oracle. It would have been greatly helpful if included, especially to test/ demonstrate queries and PL/SQL code containing collections of records and TABLE functions.

enter image description here

  • 2
    "It would have been greatly helpful if included, especially to test/ demonstrate queries and PL/SQL code containing collections of records and TABLE functions" very true, fixed! dbfiddle.uk/… – Jack Douglas May 16 at 18:42

Bug: If you [remove] all sections, then you get just the separator line, and no way to get an empty section. Clicking [+] just gives more separators.

There are problems in the display of space / empty string / NULL value:

  (1, 'foo')
, (2, '')
, (3, NULL)
, (4, '   ')
, (5, '|   |');

column1 | column2
------: | :------
      1 | foo    
      2 |        
      3 |        
      4 |        
      5 | |   |  

, ('')
, (NULL)
, ('   ')
, ('|   |');

| column1 |
| :------ |
| foo     |
|         |
|         |
|         |
| |   |   |

dbfiddle here

In the online display:

  • Note the collapsed row 2 for the empty string in the second SQL field - in the fiddle, not here.

In the markup:

  • Some way to distinguish rows 2, 3 and 4 would be useful.

I sharpened the demo to include single quotes and <tag>):

, (NULL)
, ('')      -- empty string
, ('''''')  -- actual single quotes
, ('   ');  -- spaces

| column1 |
| :------ |
| <tag>   |
|         |
|         |
| ''      |
|         |

dbfiddle here

Maybe rendering with a <pre> block would be an improvement? Would also take care of the comments you mentioned.

| column1 |
| :------ |
| <tag>   |
| null    |
| ''      |
| ''      |
|         |

You'd have to escape <. I used &lt; above ...

Included your italic null, added italic single quotes for empty string. May be hard to distinguish from literal single quotes. But still an improvement, because the distinction between empty string and space is more important because it's a more common problem.

All spaces remain to be solved ... Some corner cases are hard to solve. Most clients have a hard time to get it right.

The only change I am convinced is good is the italic null. The rest is just ideas ...

See this related meta-post:

  • I can put an italic *null* in row 3 for the markdown too, but I can't think of a good way of distinguishing rows 2 and 4, do you have a suggestion? – Jack Douglas Mar 16 '17 at 8:24
  • @JackDouglas: Italic null sounds like a good idea. I added some more above. – Erwin Brandstetter Mar 16 '17 at 12:44
  • I found this was much harder than I anticipated due to the way SE handles code blocks and syntax highlighting. The only solutions I found that retained syntax highlighting also separated the SQL and result table into two block visually which I think isn't good. In the end, all I've done is add a plain 'null' for nulls in the markdown (no way of disambiguating the text "null"), and added a &nbsp; where there is an empty string in the tabular output to prevent rows collapsing: dbfiddle.uk/… – Jack Douglas Mar 16 '17 at 17:00
  • 1
    @JackDouglas: I expected this to be harder than it looks ... Separating code and results does not seem so bad to me. I often do that on purpose in my answers. – Erwin Brandstetter Mar 16 '17 at 17:11
  • What do you think of this output? i.stack.imgur.com/GJ0Xu.png – Jack Douglas Mar 16 '17 at 17:22
  • I mean just from the POV of the blockquote to separate the statement/result pairs – Jack Douglas Mar 16 '17 at 17:23
  • I think that's good. – Erwin Brandstetter Mar 16 '17 at 22:16
  • 1
    OK, I've implemented that on a trial basis, we'll see if others agree it is an improvement. I think it is, and I'm delighted that the syntax highlighting works, there is no need for the /* */ commenting, and we can have italic null in the markdown output, all at once. Thanks a lot for the input Erwin. – Jack Douglas Mar 17 '17 at 9:54

You must log in to answer this question.

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