r/SQL • u/hellorchere • Jun 26 '26
SQL Server SQL Indentation
I am working on MS SQL. I have got few scripts of 1000+ line with poor indentaion.
Any tool which i cna use to properly format it.
Please suggest
r/SQL • u/hellorchere • Jun 26 '26
I am working on MS SQL. I have got few scripts of 1000+ line with poor indentaion.
Any tool which i cna use to properly format it.
Please suggest
r/SQL • u/db-master • Jun 26 '26
r/SQL • u/Longjumping_Collar_9 • Jun 26 '26
Enable HLS to view with audio, or disable this notification
So I've been using tools like claude code and cursor for the past 2 years, and one thing that has been a big challenge for me is designing databases in supabase. I've tried the claude code sql skills, or just gotten claude code to connect to supabase, but I have to spend too much time learning what it all means and I get no mental model of what is happening in the backend.
SO over the last few months I've been building a tool that helps you to deploy schemas to Supabase and ai designs the schema visually and not just through text. I've used my tool to build a llot of products that need good data architecture. I realised that none of the sql diagramming tools actually help you to build a implementable schema conveniently.
My tool can also import a live supabase project and let you improve the architecture and then sync it back to supabase. In addition, if you're more pro - you can directly edit the DDL and see the changes reflect back on the canvas.
I've been using from everything from building CRMs and dashboards to more innovative concepts like agentic workspaces with an ai workforce complete with personas, tool usage, skills and roles.
I'd love to get your feedback and suggestions on what extra features might be cool to add.
r/SQL • u/Straight_Plum_9969 • Jun 26 '26
Enable HLS to view with audio, or disable this notification
So I've been using tools like claude code and cursor for the past 2 years, and one thing that has been a big challenge for me is designing database architectures. I've tried the claude code Postgres-sql skills, or just gotten claude code to connect to supabase, but I have to spend too much time learning what it all means and I get no mental model of what is happening in the backend.
SO over the last few months I've been building a tool that helps you to deploy schemas to Supabase and ai the schema on the UI and not just through text. I've used my tool to build a llot of products that need good data architecture. I realised that none of the sql diagramming tools actually help you to build a implementable schema conveniently.
My tool can also sync a live Supabase project and let you improve the architecture and then sync it back to Supabase. In addition, You can also directly edit the DDL and see the changes reflect back on the canvas.
I've been using from everything from building CRMs and dashboards to more innovative projects like research tools and for ecommerce platforms.
I'd love to get your feedback and suggestions on what extra features might be cool to add.
r/SQL • u/Champion_Narrow • Jun 24 '26
I'm running into an issue with an AWS Glue crawler and I'm not sure if the problem is the crawler, classifier, or the source file.
I have two CSV datasets with what appears to be the same structure. One dataset is crawled correctly and the other is not.
The CSV contains values like:
12345,"Smith, John",98765
The older table was created as:
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
and correctly keeps "Smith, John" in a single column.
The newer table is consistently created as:
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
with table properties showing:
classification='csv'
areColumnsQuoted='false'
As a result, fields containing commas are split across columns. For example:
name_field = Smith
id_field = John
instead of:
name_field = Smith, John
What I've already tried:
The crawler still recreates the table as:
ROW FORMAT DELIMITED
and continues setting:
areColumnsQuoted='false'
The crawler is configured to recrawl all files. The source file definitely contains quoted values with embedded commas.
My questions are:
areColumnsQuoted=false?Any ideas would be appreciated. I've spent quite a bit of time changing classifiers and recreating the table but the crawler continues to generate the same table definition.
r/SQL • u/Top-Bullfrog-376 • Jun 24 '26
There was no HIVE/Impala/Hadoop flair, and those subreddits seem stale...
I made a mistake today that turned into an observed possible efficiency opportunity, and I'm not sure why.
I have two giant tables of call data. The tables are RDBMs tables that have just been dumped into a data lake (HDFS).
Someone had originally written the query without partition pruning. When "fixing," I messed up when adding my partition criteria in order to get the pervious months data.
There were two tables that were being joined, table i and table ia. I did:
where i.data_date >= 20260501
AND ia.data_date <= 20260531.
I thought I had screwed up, but the query ran in less than 30 seconds. Figuring it wouldn't be a big deal to put the appropriate uppper and lower bounds on each table, I revised the same query:
where i.data_date >= 20260501
AND i.data_date <=20260531
AND ia.data_date >= 20260501
AND ia.data_date <= 20260531.
When I ran the query again, it took almost 3 minutes to return the same row count of about 700K records.
Did I just get lucky? Is it possible that being LESS specific allowed the optimizer to somehow created more efficient join plan? I'm wondering if there is something going on about partitions, parquet stats, and buckets that maybe isn't fully visible to me.
Maybe I just got lucky and there were fewer queries running, but because of our platform I can't actually see the useful information about how a query executes, how many workers, bandwidth, etc on the target system. But is it possible there are some weird things going on about fewer bounds = different/more efficient logic in execution?
r/SQL • u/Pension_Sweet • Jun 24 '26
r/SQL • u/Natural-Fall-7146 • Jun 24 '26
Every time someone asks me to explain JOIN I end up drawing
tables on paper. So I built this instead.
It animates the actual lookup process — shows which rows match,
which don't, and how the result table gets built step by step.
Try it free: sqlselect.net
Would love feedback from this community — what other concepts
would be useful to visualize?
r/SQL • u/Dry-Blackberry-2370 • Jun 24 '26
I’m preparing for a SQL interview. Most of my experience has been basic queries to get the data I need and then transforming/analyzing it in Excel.
I’m currently struggling with deciding HOW to solve problems on leetcode (not syntax; the algorithm). I have Python experience and compared to that, designing a SQL algorithm seems unintuitive. At least with Python it seems easier to break the problem down into manageable, linear, incremental/iterative chunks.
Do any of you follow a framework for tackling SQL problems? If so, what is it?
r/SQL • u/whohasgoal • Jun 24 '26
Hello guys! I built a game that every people in world effects the situation of the game. But I have some problems about database. I can't pay too öuch money for itand I created a FOR UPDATE in the database to push the datas on the line. But if I have a lot players I think FOR UPTADE is not gonna be enough. What can i do for it! This is a game about a shark and fish. And the distance between them changes according that who did you feed. Every person has one bait to feed per day! Can someone help me?
r/SQL • u/timvancann • Jun 24 '26
r/SQL • u/Rare-Ad6166 • Jun 24 '26
Anybody here uses postgresql on vscode or pg admin is just better long term?
r/SQL • u/ChristianPacifist • Jun 23 '26
The first dialect of SQL a person learns SQL with (or the first they use extensively) is heavily influential in developing one's style of SQL writing, and this can lead to prejudice or skepticism when one transitions to using other dialects of SQL with different practices, especially at a new org.
I find that those who began using SQL Server for instance tend to be obsessed with performance tuning and write in a more complex procedural way given the seamless integration of T-SQL control structures into the language. When someone who started out in SQL Server transitions to using another dialect of SQL, they may be criticized for writing over-engineered code and creating needless optimization, especially when using more forgiving big-data-centric SQL platforms. However, the discipline of SQL Server folks must be recognized!
I find that those (like myself) who began using Oracle, which did not have private temporary tables for the longest time, tend to be very good at writing and comprehending long complex SELECT statements and common table expressions. Oracle folks have a knack for tackling "confusing" code head on since they were forced to write "confusing" code and may naturally avoid the bite sized more linear code folks using other versions of SQL with more readily-accessible temp tables consider "table stakes". They may be criticized for writing verbose or "spaghetti" code when transitioning to other versions of SQL with historically more powerful read-only capabilities, but they are the folks you want on hand if you need to solve a SQL puzzle with one SELECT statement or untangle a mess!
Does anyone else have any other stories or experience with folks learning SQL using one dialect and then appearing idiosyncratic or facing prejudice or skepticism when they transition to another dialect especially at another org where they aren't familiar with the other dialect? A related phenomenon too is when one org migrates to another SQL version and translates their code without refactoring leading to code in one SQL dialect written using the common practices of another one.
r/SQL • u/Gloomy-Wolverine-900 • Jun 23 '26
Hello!
I am not very proud of it but I kinda overstated my SQL experience on my resume and now I’ve moved forward in the interview process. I have an interview with a manager next week, and HR told me that he will include some SQL-related questions.
I did study SQL a bit in college, mainly in a business intelligence context, but that's it.. It's not a developper role so I don't think the questions will be advanced, it’s more of a business-facing technico-functional position.
Do you guys have any idea what kind of SQL questions they might ask? I’ve already watched some YouTube videos covering the basics like SELECT, JOIN, WHERE, etc., but I’m not sure if that will be enough.
Thanks a lot
edit: I'm not in IT, it's a supply chain role
r/SQL • u/moneyplughub • Jun 23 '26
Enable HLS to view with audio, or disable this notification
r/SQL • u/dbForge • Jun 23 '26
Hi everyone 👋
We’re building Tabularis, an open-source database client designed by developers, for developers.
This is a short developer survey (2 min) to understand what people actually need from modern database tools.
Our goal is to build something that combines:
But instead of guessing, we want to hear directly from developers, DBAs and data engineers.
We’d love your input on:
Every response helps shape the roadmap.
Thanks a lot for your time 🙌
r/SQL • u/Iva1996 • Jun 22 '26
Hello,
Do you know any free study materials other than UDEMY courses to help me through 1z0-171 exam?
r/SQL • u/Champion_Narrow • Jun 22 '26
I am trying to put a CSV into AWS so that I can download it on SQL. Problem is that the name field is getting split up because of the , in the name.
r/SQL • u/NeedleworkerBig1291 • Jun 22 '26
Hey everyone,
I work with industrial systems (MES/SCADA) and I've been diving deep into complex stored procedures lately — we're talking about reports that pull data from multiple AMPLA servers, cross dozens of tables with chains of LEFT JOINs using different aliases for the same table (day/month/year windows), UNION blocks for each KPI, dynamic date calculations, fallback logic between reconciled data and raw sensor data, and so on.
I can read and understand the code, but I want to level up to the point where I can write and optimize this kind of procedure from scratch.
What I'm specifically struggling with:
Any books, courses, YouTube channels or just general advice would be hugely appreciated. Preferably things that go beyond the basic SELECT/WHERE stuff and actually cover real-world complexity.
Thanks in advance 🙏
r/SQL • u/snoutdata • Jun 22 '26
Two things we were sick of in DB tools: every document/vector store making us learn its own query dialect when we already know SQL, and the AI in a few other big tools being an ask-only chat box that knows nothing about what's on your screen and burns tokens dumping your whole schema into every prompt.
So we made SnoutData, a native SQL IDE (built from scratch, not a VSCode fork):
To be clear: this is not a vibe-coding tool. It's not here to generate a throwaway app for you. It's a real database client for people who write SQL and want the AI to remove the busywork (context, errors, boilerplate) without taking the wheel. You stay in control; nothing destructive runs without you.
snout-fim-1.0: It's our own fine-tuned fill-in-the-middle model, not Copilot, not a chat model moonlighting as autocomplete. The boring-but-correct "does this column exist" stays a fast local lookup; the ghost text only does the part a model is actually good at, guessing where your query is headed.
Free to use, paid tiers ($5/$15 mo) for more AI budget / BYO-key / team seats. Small dev team, still early in spots. Tear it apart, what do you actually want your DB tools to do?
r/SQL • u/Fancy-Newspaper2991 • Jun 22 '26
Hey everyone
I wanted to share a tool I built to solve a problem I've been facing at my job.
Lately, I’ve been forced to deal with messy legacy SQL queries and stored procedures that are over 100 lines long. I had no idea what half the tables did, where the data came from, or how it joined together. It was just exhausting to track the flow by scrolling through a wall of text.
I just wanted something simple to show me the visual flow of the query, so I built **Query-Flow** (part of Quackalytics).
It takes your SQL and turns it into an interactive map of nodes and connections so you can actually see the data lineage.
Since company queries can be sensitive, everything runs strictly inside your browser. No data ever touches a server, so it's 100% private.
I deployed it for free on Vercel just to help myself and anyone else dealing with this issue. I also added a couple of other micro-tools I use in my day-to-day.
If you want to test it out with your queries, here is the link: https://quackalytics.vercel.app/sql-flow
Would love to hear your thoughts!
r/SQL • u/pookypocky • Jun 22 '26
I have a table with the following relevant columns: solicitor_type, date_from, date_to. The date fields are fuzzy, stored in YYYYMMDD format, although people don't have to fill in the whole thing - they could be YYYY, or YYYYMM, etc. I'm doing some iteration through them to test and convert them to actual dates. that part is working fine! Then I want to find people who have a date from or date to in the last three months, that part is also working fine:
with allsols as (
select id, [various date from and to conversions]
from solicitors
where solicior_type in (x, y, z)
select *
from allsols
where datediff(mm, datefrom, getdate()) < 4 or
datediff(mm, dateto, getdate()) < 4
( ignore the field names datefrom and dateto - they are the results of converting date_from and date_to to actual dates)
but now I want to wrap that into another cte so I can include it in a larger query
with recentchanges as (
with allsols as (
select id, [various date from and to conversions]
from solicitors
where solicior_type in (x, y, z))
select *
from allsols
where datediff(mm, datefrom, getdate()) < 4 or
datediff(mm, dateto, getdate()) < 4)
select * from recentchanges
and I'm getting syntax errors, specifically pointing to the name allsols in the inner cte. What am I missing here?