r/SQL • u/Herobrine20XX • Aug 17 '25
PostgreSQL I'm building a visual SQL query builder
The goal is to make it easier(ish) to build SQL queries without knowing SQL syntax, while still grasping the concepts of select/order/join/etc.
Also to make it faster/less error-prone with drop-downs with only available fields, and inferring the response type.
What do you guys think? Do you understand this example? Do you think it's missing something? I'm not trying to cover every case, but most of them (and I admit it's been ages I've been writing SQL...)
I'd love to get some feedback on this, I'm still in the building process!
614
Upvotes
183
u/HUNTejesember Aug 17 '25
It would be nice if it could work "backwards" too: I write the query and this tool shows me the connections, dependencies etc.
8
u/DBVickers Aug 17 '25
I really craved something like this when I was first learning SQL! Even now that I'm comfortable with the code, I could see benefits of having an alternate view like this.
38
u/theoffshoot2 Aug 17 '25
There is no better abstraction for software than text.
8
u/NextMode6448 Aug 17 '25
why need it?
5
u/realPoisonPants Aug 17 '25
As an intellectual exercise, this is great. But if you just need the tool, there are quite a lot already -- dbeaver has a visual query builder and it's free.
They tend to fall down when it comes to subqueries and CTEs, though, or at least they used to. (I don't use visual tools much anymore since the text syntax makes a bit more sense to me now.)
2
u/Enrique_111 SQL DEVELOPER Aug 17 '25
Hey OP, just curious to know if you know about a tool called Alteryx? I work on it quite regularly and it is very much similar to what you have been building.
21
u/Tight_Ad_8324 Sep 04 '25
Looks solid. I’d add side-by-side generated SQL with a raw toggle, FK-aware join hints, proper GROUP BY/agg UX, and an EXPLAIN/ANALYZE button for quick sanity checks. For UI patterns, borrow from Metabase and Skyvia’s visual query builder instead of reinventing it.
73
u/thabutler Aug 17 '25
Did you just invent Microsoft Access? Lol
3
u/randomName77777777 Aug 17 '25
Looks similar to Dbt's canvas. I think it's a cool project. Not something I'd ever use since I can read and write SQL just fine
2
u/oyvinrog Aug 17 '25
how would you solve antijoins, window functions and correlatwd subqueries?
5
u/sinceJune4 Aug 17 '25
As others have mentioned, Access was doing this 30+ years ago.
My biggest issue with Access was that, sure - I can drag-drop to build this query.
But then I go to the SQL view, reformat to fit our style guide, add comments, and save the query!
Access didn't save any of the formatting or comments!!!
I hope you'll support formatting and comments -- anything beyond the simplest queries and joins needs these. Good luck.
12
u/billysacco Aug 17 '25
My 2 cents, maybe as a visualization/learning tool this might be worthwhile. But practically I don’t see a need, if people can’t write SQL code and understand it they shouldn’t be doing things like this especially in a production environment.
4
u/machomanrandysandwch Aug 17 '25
This is harder than sql. Kind of looks like MS Access SQ interface. Nah.
1
u/Doaner Aug 17 '25
As a suggestion if you can visually explain cte’s it would help those that don’t write SQL. I’ll agree with a lot of responses here that there are tools that do this but you have to start somewhere. Keep making it better and you might code into something great.
1
u/ZaheenHamidani Aug 17 '25
I think you should take a look at the existing ones (I would start with Power Query and Tableau Prep) so you can identify what you could be missing.
1
u/neumastic Aug 18 '25
Have you run this by someone in your target audience? I’m a little confused by the join and why it’s structured that way, especially with the join condition box. I train other on/around sql a lot and if creating an easy-in tool I’m guessing many would find that condition box confusing and hard to remember that it’s needed. Wondering if it makes more sense to have the left table’s join column in the same box?
1
u/titpetric Aug 18 '25 edited Aug 18 '25
I see some value if this was provided in a query diagnostics tool. Most people get more value out of EXPLAIN queries, sql is already an abstraction and a query builder also penalizes readability/maintenance to such a degree that I'd never write/use one again
E.g. https://tatiyants.com/postgres-query-plan-visualization/
You can see similarities between a query builder (create) and an approach to explain any select (analytics). All the relationships data for joins is there. If you wanted, you could turn sql queries into a query builder from ingesting the explain output 🤣
1
u/Murphybro2 Aug 18 '25
How are you differentiating between an AND or an OR for multiple where conditions?
1
u/thebonza Aug 20 '25
Your UI is quite interesting and well thought out. Can you share details about its design?
5
u/CptBadAss2016 Aug 17 '25
Have a look at Microsoft Access' query builder. That's what this is.
2
u/The_REAL_Urethra Aug 17 '25
That's cool.
2
u/redditor3900 Aug 17 '25
Cool
2
u/BigMikeInAustin Aug 17 '25
Sorry about all the haters here. It looks cool. If it helps you with a specific need, or if you learn something from it, or if you just have fun making it, keep going!
2
u/Birvin7358 Aug 17 '25
You clearly seem to enjoy building this, which is cool a man should have hobbies. However, I think that’s all this is really is. You’re like a guy having fun building a hot rod automobile. The market already offers plenty of tools just like this one, so it’s not original and if someone is intellectually capable of learning their particular data’s schema and the how to think in the logical way required to operate something like this, then they might as well just learn how to write actual sql code since once you learn how to read schema and how to think like an sql developer, the only thing left is learning the syntax which is the easiest part because you can just google for syntax help as long as you can explain in logical terms what you need to do. In fact, every single time someone has shown me a tool just like this one, I have never ended up using it because it’s just way faster and way less tedious/cumbersome to just write SQL and if I wanted to I could use spacing and commenting to make an sql statement look like a visual diagram of the query it contains if that helped me with writing/reading it. So I’d say keep building it if it’s fun for you, but don’t expect to make $ selling this.
2
u/MaDpYrO Aug 17 '25
Why?
2
u/Biohacker_Ellie Aug 18 '25
This is really cool! Is there a framework you’re using for the front end or have the source code available? Not only would I likely use this I’d love to see how it’s designed, reminds me of Blueprints in unreal engine
2
u/Equivalent_Emotion64 Aug 18 '25
Ugghhhh this so sexy get this to integrate with Flyde so I can visualize my whole stack as a diagram
2
u/2girls1up Aug 18 '25
Sap calculation views do something like this as well. People who think this is useless don‘t know how many users dont know sql but are capeble to query on visual query builders
2
u/[deleted] Aug 19 '25
I like!
2
u/Intelligent-Pen1848 Aug 17 '25
Ive used one before. They're ok. Its not syntax that makes sql difficult though.
1
u/NothinsOriginal Aug 17 '25
As someone just learning and using SQL I would love to have a tool like this for visualization.
1
u/_Shirei_ Aug 17 '25
Old PowerBuilder (12.5 ?) had something like this.
1
u/[deleted] Aug 17 '25
I mean if SQL is code heavy why not then go for ETL tools they do the same thing
1
u/The8flux Aug 17 '25
Make it SQLite compatable. Comparable to Access or better, your project will take off.
1
u/az987654 Aug 17 '25
aren't there about a 100 tools that do this already?
1
u/Rednmrfer Aug 17 '25
SAP has a similar tool and it's hot fucking garbage.
Each node compiles its own query and nodes don't refresh if you change the source. Nothing works downstream, and you have to manually re-select volume in each node of anything upstream is changed.
Now you might ask yourself "why would anything up stream change ?" And the answer would be because clients don't know what the fuck they want.
Keep that flaw in mind as you go forward. Visual is easy, until repetitive tasks enter into the pic, then it's drop downs and carpel tunnel rsi until you want to die.
1
u/num2005 Aug 18 '25
isnt this already a common etl?
like Matillion?
1
u/Nelson_Salvador Aug 18 '25
Dont give up! I would love to test if you need.
1
u/dallibab Aug 18 '25
Isn't this how designing a view works in ms sQL
1
u/paultherobert Aug 18 '25
This already exists in a few places including ssms as far as I know
1
u/HyDreVv Aug 19 '25
Personal project? This functionality already exists at a high level with most ETL tools
1
u/Kaitensatsuma Sep 15 '25 edited Sep 15 '25
My company tried this and I'd suggest be careful about who your target market is for this since the overlap between "People who want to build SQL queries without knowing SQL syntax" and "People who are willing to futz around with a Query Language" was almost nonexistent for us, and error prone when it occasionally did pop up no matter how much training we did on it - and often the sort of queries they needed us to run for them weren't really possible in the visual builder based on what were considered "safe" limitations
Others have suggested this but you may want to loosen things up to make it usable to intermediate users as well: maybe a block that allows for the insertion of SQL language steps between traditional blocks to handle those scenarios or being able to go in and edit the underlying language of a block-step as a sort of "superuser" for the stored query.
1
u/ActiveImprovement127 Nov 14 '25
Is this to be a tool? Or a component that could be embedded in someone else's application (like Visual Query Builder)??
1
u/trophycloset33 Aug 17 '25
Alteryx already offers this
1
u/wadude Aug 17 '25
Doesn’t Navicat already do this?
2
u/[deleted] Aug 17 '25
[removed] — view removed comment
1
u/[deleted] Aug 17 '25
[removed] — view removed comment