Update Jan 2020:

Please note, the place for reporting db<>fiddle bugs and feature requests is now on this TopAnswers post pending a future move to a GitHub issue tracker!.

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)
  • Firebird 3.0
  • MariaDB 10.2, 10.3 and 10.4
  • MySQL 5.6, 5.7 and 8.0
  • Oracle 11.2 and 18
  • Postgres 8.4, 9.4, 9.5, 9.6, 10, 11 and 12
  • SQL Server 2012, 2014, 2016, 2017, 2017 Linux and 2019 Linux RC1
  • SQLite 3.8, 3.16 and 3.27 (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?

As of Apr 2019 you can now hide batches selectively.

| |
  • 14
    +1, +10, +1000000000000000000 – ypercubeᵀᴹ Feb 16 '17 at 18:28
  • 7
    ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ – MDCCL Feb 16 '17 at 21:14
  • 3
    +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
  • 3
    @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
  • 5
    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
  • 5
    @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

50 Answers 50


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
  • NB: Bug in the last output value: dbfiddle.uk/… (query to answer: stackoverflow.com/a/53324597/361842) – JohnLBevan Nov 15 '18 at 17:40
  • @JohnLBevan please can you explain the bug, it isn't obvious to me (preferably in a new answer here rather than a comment on this answer)? – Jack Douglas Apr 10 '19 at 8:50
  • "having to click the + button for each new statement is a bit cumbersome" — I've come round to thinking you are right so a blank batch is now auto-added if you edit the last batch. Please let me know if you find this better? I'm also aware that at some point I broke the 'auto-splitting' feature, but I've had second thoughts about that too. Now if you paste test that includes multiple separators the page will just prompt you to click the 'split' button by making it visible). – Jack Douglas Apr 10 '19 at 8:52
  • @JackDouglas Apologies; I can't see any issue now; not sure if the bug's been fixed, or if it was user error on my part. Please disregard my previous comment. – JohnLBevan Apr 10 '19 at 11:09

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 '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 '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 '18 at 14:36

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.

| |
  • 2
    that does look useful. do you know of any PHP or javascript libraries that do this sort of thing so I don't have to re-invent the wheel? – Jack Douglas Apr 26 '17 at 16:17
  • Sorry I dont. But maybe you can ask @jakefeasel the sqlfiddle developer. – Juan Carlos Oropeza Apr 26 '17 at 16:26
  • 3
    that gave me an idea :) — github.com/jackdouglas/DDLBuilder – Jack Douglas Apr 26 '17 at 16:29
  • Great. Cant wait to see it working :) – Juan Carlos Oropeza Apr 26 '17 at 18:06

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
  • 1
    ⑦ 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
  • 2
    ⑦ 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
  • 1
    @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

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
  • 4
    "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

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

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()):

| |

Extensions / additional modules for Postgres

Besides plpgsql (installed by default) I currently see these additional modules on your site for PostgreSQL 11:

select * from pg_extension;


I repeatedly found myself wishing for some more. Most importantly:


All of them included in the contrib module of the main distribution. See: "Appendix F. Additional Supplied Modules"

intarray, hstore and unaccent are essentials, and tsm_system_rows is tiny and convenient.
(dblink is also common and useful, but may be to powerful for your site. So I did not include it in the wishlist.)

Would you think it's possible to install those?

| |
  • 1
    Hi Erwin, thanks for the suggestions. We've added the extensions on your wishlist to the Postgres 11 server: dbfiddle.uk/… – James Douglas Feb 12 '19 at 11:03
  • @james: thanks a lot! i'll have a look as soon as the flu goes away. – Erwin Brandstetter Feb 13 '19 at 9:43

Is there a chance we get Oracle 18c version?

Oracle Database 18c XE now available!

| |
  • 1
    I've already downloaded it and hope to have it installed in the next few days :) – Jack Douglas Oct 22 '18 at 15:39
  • 1
    it's looks like it's working, so please give it a whirl: dbfiddle.uk/… – Jack Douglas Oct 23 '18 at 14:51
  • 1
    @JackDouglas Wow, it is marvelous! Thank you so much. Now I could provide more demos on SO :) – lad2025 Oct 23 '18 at 14:53
  • @JackDouglas Polymorphic Table Function demo This is magnificent 👍 – lad2025 Oct 23 '18 at 15:26

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 '18 at 12:42
  • 1
    @JackDouglas : Wow! You fixed it so quick.. Thanks a lot. That greatly helps. – Kaushik Nayak May 26 '18 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 '18 at 12:59

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
  • re "While faith may be an important topic to some, does it really warrant promotion from a technical help site?", see my comment here: dba.meta.stackexchange.com/questions/2686/… – Jack Douglas Mar 19 '19 at 16:49
  • 1
    re "Perhaps you might also consider DB2 amongst your db list?", with a lot of help from @mustaccio, I've finally got this working: dbfiddle.uk/?rdbms=db2_11.1 – Jack Douglas Mar 19 '19 at 16:52
  • Fantastic! Much appreciated. – used_by_already Mar 20 '19 at 7:54

I created a three-batch script on SQL Server 2017 (Windows):

Batch 1


CREATE TABLE dbo.T (n integer NULL);

Batch 2

    SELECT * INTO #i FROM Inserted
    CREATE INDEX i ON #i (n);

Batch 3


INSERT dbo.T (n) VALUES (1);


This produces no output at all when run is clicked (I expected an error about snapshot isolation not being enabled). There is no indication that db<>fiddle has tried to execute the script at all.

Please enable snapshot isolation for db<>fiddle:

| |
  • Thanks Paul. I think the bug might be a recent regression — and I think it is now fixed: dbfiddle.uk/… – Jack Douglas Aug 30 '18 at 21:18
  • I've enabled snaphot isolation on 2017 linux only because running the same script still gives a (different) error there: dbfiddle.uk/…. If you tell me that new error is expected, I'll enable it on the others too tomorrow. – Jack Douglas Aug 30 '18 at 21:26
  • That error is expected. It was the point of the demo actually. – Paul White 9 Aug 30 '18 at 21:30
  • @JackDouglas The only remaining issue is that the error message is quite long and there doesn't seem to be a way to see all of it. – Paul White 9 Aug 31 '18 at 6:33
  • 1
    Thanks, I've applied ALLOW_SNAPSHOT_ISOLATION to all the other versions and fixed the error message truncation :) – Jack Douglas Aug 31 '18 at 13:16

Not sure if it is correct place to put bug report. But let's give a try:

When I run(SQL Server 2012-2017) I can't see any result set.

SELECT i, COUNT(*) cnt
FROM tab
WHERE status = 1
GROUP BY ALL i;  -- ALL is deprecated feature


Warning: Null value is eliminated by an aggregate or other SET operation.

enter image description here

Temporary workaround:

-- workaround materializng to table
SELECT i, COUNT(*) cnt
INTO tab2
FROM tab
WHERE status = 1


DBFiddle Demo

| |
  • 1
    Thanks for spotting this — I think it is now fixed. Please let me know if you find any cases where results with informational messages don't look right. – Jack Douglas Aug 27 '18 at 14:34
  • @JackDouglas Thanks for quick response. I love that site. Is there opportunity to ugrade SQLite up to 3.25.0 when it will be GA? Many new things were added. – lad2025 Aug 27 '18 at 14:37
  • 1
    I know it's not what you asked for, but I have added 3.16. My current plan is to add whatever versions come packaged with each release of Debian (so I get security updates easily), so as long as 3.25 is released by Jan 2019 it'll appear with Buster's release later in 2019. – Jack Douglas Aug 27 '18 at 19:13
  • @JackDouglas Thanks for adding upgraded version plus info. For all available free SQL playgrounds(db-fiddle.com/rextester.com/sqlfiddle.com) your version is truly the best. I am huge fan of showing actual working code rather than query/description only. Many times I had to prove that SQL can do things that others thought were virtually unreachable. Keep up the good work! – lad2025 Aug 27 '18 at 19:44
  • 1
    Thanks very much for the kind words, and the encouragement to keep working on improving and updating the site. Please do feel free to post your suggestions here, and you may like to know I'm currently working on a side-by-side compare feature. You currently need to run the code against both databases individually then edit the url manually to get the result but there will eventually be a UI to do this :) – Jack Douglas Aug 28 '18 at 10:10
  • I already like this side-by-side feature and looking forward for release :) – lad2025 Aug 28 '18 at 14:36
  • @JackDouglas BTW Could you provide some statistics? Something like DB version - number of scripts created for last year. I am really curious which RDBMS is most popular. – lad2025 Aug 28 '18 at 14:45
  • You can probably get the info you are curious about from the 'secret' stats tables on the Postgres 9.6 database: dbfiddle.uk/… – Jack Douglas Aug 28 '18 at 15:01
  • @JackDouglas SEDE(Stack Exchange Data Explorer) for DBFiddle.uk :) Nice – lad2025 Aug 28 '18 at 15:01

Any chance you could do some user agent sniffing and completely ditch the fancy code boxes in favour of just plain old text boxes if the user is using a cellphone?

Or even simpler to implement and probably better; just a toggling link/button switcher that flips between "use fancy editor/use basic text box editor" so I can flip the mode myself?

I can't get copy or paste to work at all on an iPhone (to be fair, I haven't tested Android) with the fancy text boxes on dB<>fiddle, which kinda makes the entire site unusable for all but the simplest queries as I'd have to literally type some OP's entire query in manually off of SO etc

Many thanks!

| |
  • 1
    Thanks Caius, I wasn't aware cut/paste doesn't work on iPhone. I'm on holiday right now, but will take a look in a couple of weeks and think about what's best to do to improve that. – Jack Douglas Jun 23 '19 at 16:51

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.

| |

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.

| |

When I try to run:

FROM dual

It works on Oracle 11g but fails on Oracle 18c:

enter image description here

| |
  • 3
    Thanks, and apologies for the inconvenience — the back-end instance had crashed with an ORA-00822, but the real problem is that I neglected to add the Oracle 18 backend to our monitoring system so I wasn't notified about the crash. That's now rectified, and I may later add more memory to the instance if the crash re-occurs. – Jack Douglas Nov 22 '18 at 23:14
  • @JackDouglas Could you check if Oracle18c and MySQL 8.0 are up? I am getting Run failed messages for any query? – lad2025 Dec 2 '18 at 14:38
  • both needed restarting, should be OK now… – Jack Douglas Dec 3 '18 at 0:00
  • @JackDouglas Looks ok. Thank you once again. – lad2025 Dec 3 '18 at 16:03
  • @JackDouglas Hi Jack, it looks like Oracle18c is down again. SimpleSELECT 1 FROM dual - "Run failed" – lad2025 Jan 2 '19 at 16:12
  • sorry about that — we haven't worked out why the instance keeps stopping. It's back up now – Jack Douglas Jan 2 '19 at 16:56
  • although Oracle still crashes every now and again, we have a script running every minute to bring it back up — this seems to be working ok for now! – Jack Douglas Mar 19 '19 at 17:06

This is just question/minor bug? When do we get rows count?

For example DBFiddle Demo - PostgreSQL and DBFiddle Demo - SQL Server

enter image description here

The only difference is that I commented WHERE clause.

| |
  • 2
    row counts kick in at >5 rows, and extra rows hidden behind an ellipsis for >10 rows (you have to click the ellipsis twice for >100 and 3 times for >1000 etc): dbfiddle.uk/… – Jack Douglas Sep 2 '18 at 13:09
  • @JackDouglas Thanks for clarification – lad2025 Sep 2 '18 at 13:09

Oracle collection and COLLECT is not showing any result.

Sample scenario:


SELECT '00000000000000000001' AS NR,N'06' AS GRD,DATE '2013-01-01' AS DT 
SELECT '00000000000000000001',N'06',DATE '2013-01-01'  FROM dual UNION ALL
SELECT '00000000000000000001',N'21',DATE '2013-01-01' FROM dual UNION ALL
SELECT '00000000000000000002',N'06',DATE '2013-01-01' FROM dual UNION ALL
SELECT '00000000000000000002',N'21',DATE '2013-01-01' FROM dual UNION ALL
SELECT '00000000000000000004',N'01',DATE '2013-03-31' FROM dual;


And query:

select nr, CAST(collect(grd) AS tbl_array) grds
from tab
group by nr;

Should return:

│          NR          │              GRDS              │ 
│ 00000000000000000001 │ HR.TBL_ARRAY('06', '21', '06') │ 
│ 00000000000000000002 │ HR.TBL_ARRAY('06', '21')       │ 
│ 00000000000000000004 │ HR.TBL_ARRAY('01')             │ 

But there is no result at all.

DBFiddle Demo

enter image description here

Note: Similiar scenario with PostgreSQL is working fine.

DBFiddle Demo - PostgreSQL

| |
  • 2
    I've spent a while trawling through the PHP OCI docs and I can't see how to get the text representation of the array type (or indeed any representation). The Oracle backend is processing correctly as you can see here: dbfiddle.uk/…, but oci_fetch_all returns an empty result of type "VARCHAR2Array". – Jack Douglas Sep 1 '18 at 21:15
  • @JackDouglas Hmm, that is sad. Could you at least return something like NR - GRDS and second row 00000000000000000001 - (user defined type) and so on. I mean that I would rather get 3 rows with some indicator on GRDS than 0 rows. – lad2025 Sep 2 '18 at 10:28
  • 1
    It doesn't look like I can get anything back from the PECL OCI driver at all — even when multiple rows should be returned, if a single row has a collection, the result set I get from the driver is empty. I may have better luck with a different driver but options are limited and that would likely break more than it fixes. dbfiddle doesn't parse the sql you enter, but you can work around the issue with dump if you just want to see something: dbfiddle.uk/… – Jack Douglas Sep 2 '18 at 13:04
  • @JackDouglas Yes, dump will do the work – lad2025 Sep 2 '18 at 13:05

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 '18 at 18:42

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 '18 at 15:24
  • and I notice you are actually using 'BEGIN TRANSACTION;' on (the other) db-fiddle – Jack Douglas May 10 '18 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 '18 at 16:03
  • ah, OK, I will look into that! – Jack Douglas May 10 '18 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 '18 at 13:11

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

this morning I tried to use dbfiddle.uk with PostgreSQL 11.

Extremely simple sample SQL:

CREATE TABLE test (bill INTEGER, fred TEXT);

and then:

INSERT INTO test VALUES (1, 'sdfs'), (2, 'vcxf'), (3, 'tyiro');

followed by:


Result in PostgreSQL 10 (as expected):

bill    fred
   1    sdfs
   2    vcxf
   3    tyiro

But PostgreSQL 11 fails to do anything - not even the ticks for correctly creating the table and inserting the data.

The fiddle is here. Just as an aside, it works fine for all versions of MySQL.

| |
  • Thanks, Erwin alerted me to this in a comment and I think it is fixed. I need to find a way of restricting rogue fiddles from using up all available disk space… – Jack Douglas May 2 '19 at 18:38
  • Yes - it's fixed now. Wow, that took all of 17 minutes from bug report to fix. If only my bug reports to suppliers were sorted so quickly! :-) – Vérace May 2 '19 at 18:45
  • well it was a bit longer than that since Erwin's comment, but thanks :) – Jack Douglas May 2 '19 at 19:54

Comments/Bugs link on dbfiddle.uk directs me to here, so I suppose "answering" is the way to submit bugs:

Select MySQL 5.7 as database and try this extra simple DML command:

create table errorTest (id integer, issue text);
insert into errorTest (id, issue) values (1,'issue #1');

It is expected to work but comes up with an error message saying:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insert into errorTest (id, issue) values (1,'issue #1')' at line 2

| |
  • yes this is exactly the right way to submit bugs, thanks :) the MySQL PHP driver we use does not accept multiple statements per line, so you have to split them up: dbfiddle.uk/… – Jack Douglas May 4 '19 at 17:46
  • I see you have used — it's a bit confusing that the SQL Server driver is happy to have multiple statements per batch and MySQL is not. – Jack Douglas May 4 '19 at 18:05
  • actually it looks like it is possible, but when I've asked before I've been told it isn't necessary. Do you think it would be helpful compared to just splitting up the fields? – Jack Douglas May 4 '19 at 18:11
  • `Sorry I don't understand the comments exactly, as far as I understand, you are saying it is a fault of PHP. Driver accepts multiple statements with 65536 parameter, no? Anyway, I am not a fan of MySQL. The same query works well on db-fiddle.com and sqlfiddle.com. – Cetin Basoz May 4 '19 at 18:39
  • I'll let you know when we get multiple batches working (using mysqli, so not as simple as passing 65536 would be unfortunately, but apparently still possible) – Jack Douglas May 4 '19 at 22:29
  • Hi Cetin, I've implemented this feature — please let me know if it doesn't work the way you expect. Here is your example code working: dbfiddle.uk/… – Jack Douglas May 6 '19 at 6:01
  • 1
    Thanks for the update, it is working fine now :) I am glad, I prefer dbfiddle.uk over other sites (wish I knew hosting problem before). – Cetin Basoz May 6 '19 at 11:56
  • Thanks for the encouragement and support — feel free to bring up anything else here, eg improvement suggestions. – Jack Douglas May 6 '19 at 15:02

Bug report: cannot create a function in MariaDB link:

You do not have the SUPER privilege and binary logging is enabled (you might want to use the less safe log_bin_trust_function_creators variable)

though for MySQL I can.

| |
  • thanks for letting me know about this, it's all working now. – Jack Douglas Aug 14 '19 at 7:42

Thanks for your site.

I have two requests:

  1. Improvement: current Firebird is 3.0.1, the current latest is 3.0.4. Would it be possible to upgrade?
  2. Bug: The result set uses the 'original column name' instead of the alias. The 'original column name' isn't always present. Depending on how the query is constructed it is 'lost' in some versions of Firebird, or never existed in the first place (eg with literals in the select clause), and for example function calls will use the function as the original column name.

    For an example see this fiddle. The first select should have column heading SHIFT_LOG_DET_ID, ENTRY_TIME, DURATION, but has (empty), (empty), DATEDIFF. The second select should have SHIFT_LOG_DET_ID, ENTRY_TIME, DURATION, but has SHIFT_LOG_DET_ID, ENTRY_TIME, DATEDIFF.

    enter image description here

    In the low-level Firebird API this is the difference between using isc_info_sql_field (original column name) or isc_info_sql_alias (alias).

| |
  • 2
    Thanks Mark, I've switched from Debian Stretch to Buster which has 3.0.5 packaged, and fixed the alias/name bug. – Jack Douglas Sep 21 '19 at 8:27
  • @JackDouglas Thanks! Be aware that - although pretty stable - 3.0.5 is not yet released. – Mark Rotteveel Sep 21 '19 at 8:47
  • I'm not sure why the Debian team decided to use 3.0.5 before release, but it might be related to this bug: security-tracker.debian.org/tracker/CVE-2017-11509. I'm doubly grateful for this bug report as the security vulnerability slipped under my radar and this kind of thing is potentially very nasty for db<>fiddle. – Jack Douglas Sep 21 '19 at 8:52
  • 1
    @JackDouglas Possibly, yes. In Firebird 4 UDF support will be disabled by default and it has been deprecated (the replacement feature, UDR (User-Defined Routines), has mitigations for this AFAIK). You can disable it in any firebird version by setting UdfAccess = None in firebird.conf. – Mark Rotteveel Sep 21 '19 at 9:10
  • Thanks — that's useful to know. – Jack Douglas Sep 21 '19 at 10:10
  • hopefully External Tables were disabled too in conf-file? Or at least are directed to special disk volume that can be safely overflowed without affecting rest of the service. – Arioch 'The Sep 26 '19 at 14:50
  • @Arioch'The The ExternalFileAccess setting defaults to None so it is disallowed by default, contrary to UdfAccess which defaults to Restrict UDF which means it points to the UDF directory of the Firebird install by default. – Mark Rotteveel Sep 26 '19 at 16:44
  • @MarkRotteveel in vanilla sources tarball - perhaps. But what about specific Linux distro binary repo? for such a thing as vastly promoted WWW site - security is to be checked not implied I guess – Arioch 'The Sep 26 '19 at 17:09

The height of the scroll container is too low. I strips of some pixels from the lowest line, making commas and other delimiters quite unreadable:

lower pixels of the line are hidden, commas show as dots, semicolons and colons are indistinguishable

The height seems to be computed explicitly somewhere and set as an inline style. Using em here works better for me, or just add some margin please.

| |
  • Thanks for prompting me to fix this, it was an annoying niggle. – Jack Douglas Sep 25 '19 at 13:50
  • Whoa thanks, that was quick! – Bergi Sep 25 '19 at 13:53

I really love the db<>fiddle. But sadly I am never able to edit my fiddles with my smartphone (Android, Chrome). There is a very strange behavior with text typing. It sometime overrides the original text when trying to insert something or puts the new text on wrong positions.

The cursor behavior is very strange as well or better: it is hard to handle (finding the right position, move something, ...)

It would be great to use your fiddle on mobile devices as well. Maybe you could check this because at the moment it is really not usable for me.

| |
  • I haven't currently got an Android phone to test on, so I've only tested it on iPhone. We'd certainly like to get it working properly on Android, so I'll see if I can get hold of something to test it on. – Jack Douglas Sep 28 '18 at 16:06
  • Do you know a good Android emulator for OSX? – Jack Douglas Sep 28 '18 at 16:11
  • No I am sorry. I am out of Android development for a few days. Hoping someone can help you. – S-Man Sep 28 '18 at 20:35

I really like to know: When I execute multiple statements in one field (e.g. https://dbfiddle.uk/?rdbms=postgres_9.6&fiddle=a0fc52d4e45e4d925b428fabcdee70f5), are they treated as one transaction or are they committed separately?

| |

I got a problem with MySQL when I wanted to execute more statements in one field.

Please have a look at this working example (Postgres): https://dbfiddle.uk/?rdbms=postgres_9.6&fiddle=a0fc52d4e45e4d925b428fabcdee70f5

Now I changed the DBMS into MySQL and tried the same: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=a0fc52d4e45e4d925b428fabcdee70f5

That wasn't working. But if I split the statement into one field each, it is working: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=b6166ff71140b5957794f1f6c9fb9780

Why does the multi execution work with Postgres but not with MySQL?

| |
  • db<>fiddle's design philosophy is against parsing the SQL you enter at all (the one exception being the 'split batch' function, but that is really peripheral to the main working of the site). In other words, this behaviour is inherited from the database itself, or the drivers used to access the DB. There is either something about MySQL or something about the MySQL driver for PHP causing this. It may well be related to this: stackoverflow.com/a/13982705/6854914 but it looks like there are pros and cons. – Jack Douglas Sep 29 '18 at 11:14

You must log in to answer this question.

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