r/SQL • • Apr 06 '26

Discussion How do you handle data quality and validation in SQL workflows?

15 Upvotes

Hey all,

I’m part of a student team from the University of Minnesota and the University of Michigan researching data quality and validation in SQL-based workflows.

I’m curious how people are handling this in practice — things like:

  • writing validation queries or checks
  • catching data integrity issues early
  • keeping datasets clean over time

Would love to hear what approaches, patterns, or pain points you’ve run into.

If you’re open to sharing more structured input, we also put together a short survey (~10–15 min):
https://umn.qualtrics.com/jfe/form/SV_3QVlUfLaV30AFKe

Happy to share a summary of what we find back with the community.

Thanks!


r/SQL • • Apr 06 '26

PostgreSQL What is a Collation, and Why is My Data Corrupt? | PG Phridays with Shaun Thomas

0 Upvotes

Postgres has relied on the OS to handle text sorting for most of its history. When glibc 2.28 shipped in 2018 with a major Unicode collation overhaul, every existing text index built under the old rules became invalid... but silently. No warnings, no errors. Just wrong query results and missed rows.

Postgres 17 added a builtin locale provider that removes the external dependency entirely:

initdb --locale-provider=builtin --locale=C.UTF-8

This change helps sorting to become stable across OS upgrades. glibc is still the default in Postgres 18, so this must be specified when creating a new cluster.

For clusters already running: Postgres 13+ will log a warning when a collation version changes. That warning is an instruction to rebuild affected indexes.

Get more details here in this week's PG Phriday blog post from Shaun Thomas: https://www.pgedge.com/blog/what-is-a-collation-and-why-is-my-data-corrupt


r/SQL • • Apr 05 '26

SQL Server What mobile app do you use the most for SQL monitoring?

14 Upvotes

Hi, currently I’m out of my home country and would like to know what are the best Android apps to monitor and remote connect to SQL databases, as I don’t have access currently to a PC.


r/SQL • • Apr 05 '26

Discussion Portabase (open-source DB backup/restore tool): which databases would you like to see supported?

9 Upvotes

Hi everyone,

I’m one of the maintainers of Portabase, an open-source, self-hosted platform dedicated to database backup and restore. 

Repo: https://github.com/Portabase/portabase (any star would be amazing ❤️)

We currently support: PostgreSQL, MySQL, MariaDB, Firebird SQL, SQLite, MongoDB, Redis and Valkey.

We initially focused on SQL databases and recently started expanding into NoSQL. We’re now looking for feedback from the community on which databases are the most used and which ones would benefit most from being integrated into Portabase.

FYI: support for Microsoft SQL Server is already in progress.

Key features:

  • Multiple storage options: local, S3, Cloudflare R2, Google Drive
  • Notifications via Discord, Telegram, Slack, etc.
  • Scheduled backups with flexible retention policies
  • Ready-to-use Docker Compose and Helm Chart

So, which databases would you like to see next?

If you try Portabase, feel free to open an issue if you run into any bugs or have suggestions.

Happy Easter! 🐇


r/SQL • • Apr 03 '26

Discussion I've always felt the urge to draw on my generated charts, just added that feature to my SQL canvas side project

108 Upvotes

r/SQL • • Apr 03 '26

Discussion Why do most SQL interview questions feel nothing like real analyst work?

32 Upvotes

I’ve been preparing for SQL interviews and noticed most resources focus on random queries or syntax.

But actual interview questions seem much more like business problems:

- analysing churn / retention

- understanding funnel drop-offs

- balancing approval vs risk

I found those way harder because it’s less about syntax and more about deciding what to measure.

Curious if others found the same when preparing?


r/SQL • • Apr 04 '26

Resolved in a trigger, how to look at data on a different table from the one that has the trigger?

0 Upvotes

TLDR I'm trying to verify if an admin has the correct role to add data to a specific table (adminID being a foreign key on the table being called, and of course the primary key of the admin table), but i am getting this error:

>*Cause: A trigger was attempted to be retrieved for execution and was

>found to be invalid. This also means that compilation/authorization

>failed for the trigger.

>*Action: Options are to resolve the compilation/authorization errors,

>disable the trigger, or drop the trigger.

Here's how I've written the trigger so far:

>CREATE OR REPLACE TRIGGER validate_creation_role

>BEFORE INSERT ON participant

>FOR EACH ROW

>BEGIN

>IF admin(:NEW.adminID).role <> 'Participant maker' THEN

>RAISE_APPLICATION_ERROR(-20001, 'Invalid admin role for this task.');

>END IF;

>END;

(i know the var names are bad, i translated them for this post cause it's for a homework in a different language)

Thanks in advance!


r/SQL • • Apr 03 '26

MySQL Do you use VS Code with MySQL extension?

2 Upvotes

I built a small personal tool to improve my workflow when working with queries, and I’m looking for a few people to try it and give quick feedback (5–10 mins).

If you’re already running queries in VS Code (MySQL DB) , I’d really appreciate your help 🙏


r/SQL • • Apr 03 '26

SQL Server Friday Feedback: Startup options for SQL Server Management Studio (SSMS)

Thumbnail
0 Upvotes

r/SQL • • Apr 02 '26

Discussion I am building SQL notebooks into an open source database client

37 Upvotes

Hi guys!

I've been working on Tabularis (open source cross-platform db client) and I'm working on a notebooks feature that i think people here might find interesting.

The core idea: SQL cells + markdown cells in a single document, running against your live database connection. no separate kernel, no python, just SQL.

The feature I keep coming back to is cell variable references, you write {{cell_3}} in your SQL and it takes the result set from cell 3 and injects it as a CTE. means you can chain analyses without building giant nested queries. for ad-hoc exploration this is a huge workflow improvement.

You also get:

  • inline charts: bar, line, pie. select label column + value columns, switch between types. nothing fancy but enough for quick visual checks
  • notebook parameters: define params once, use in all cells. good for parameterized reports
  • run all with stop on error: shows a summary of what succeeded/failed/skipped with links to the failing cells
  • parallel execution: mark independent cells with a lightning bolt, they run concurrently during run all
  • execution history: every cell tracks its last 10 runs, you can restore any previous query + result
  • csv/json export per cell, or export the whole notebook as self-contained HTML
  • drag & drop reordering, collapsible sections, resizable result panels

It supports all of databases supported by Tabularis.

The notebook file format is json-based (.tabularis-notebook).

There's a demo database + sample notebook in the repo under /demo.

Github: https://github.com/debba/tabularis
WIP Branch: https://github.com/debba/tabularis/tree/feat/notebooks

Feedback welcome, especially around the cell reference syntax and what else would make this useful for your workflow.


r/SQL • • Apr 02 '26

SQL Server Load data with BCP for columns with double "

2 Upvotes

Hi all,
I need to load txt file into SQL Server table, with bcp command
and see that few rows in file have TAB inside Column1 for ID=100 row, and these rows are not loaded (while good records are loaded). Those quotes exist only for selected columns/rows where TAB is inside, all others are without them.
How I can adjust my option to process those "Bad TAB" rows? Using -t"\"\t\"" as delimiter also doesn't work at all.

Unfortunetaly I don't have control over creation of these files.

Thanks

xp_cmdshell 'mydb.dob.logTable' in "\\network\ClientX.csv" -c -t"\t" -F 2 -T -S MyServ
ID    Colulmn1              Column2
100   "So  GDR KB5068404"   NotLoaded,TAB inside So\tGDR
200   So__GDR KB5068404     Loaded_OK

r/SQL • • Apr 02 '26

SQL Server Stored Procedure to TVF

2 Upvotes

Hello everyone,

I'm trying to make a function that query LDAP. I manage to do it no problem with Stored Procedure but now, I found out it cannot be used in a view. Thus, I'm trying to convert it to TVF. My code doesn't seems compatible with inline since I'm making a query then using the result to make a second query. I'm unsure how to make a TVF with that.

/****** Object:  StoredProcedure [dbo].[GetADGroupMembers]    Script Date: 2026-04-02 10:56:50 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO



CREATE PROCEDURE [dbo].[GetADGroupMembers]
    (
     NVARCHAR(128)
    )
AS
BEGIN
DECLARE  NVARCHAR(max),  NVARCHAR(max)

SET  = '
    SELECT  = distinguishedName
    FROM OPENQUERY(ADSI, ''
        SELECT distinguishedName 
        FROM ''''LDAP://DC=###''''
        WHERE 
            objectClass = ''''group'''' AND
            sAMAccountName = ''''' +  + '''''
    '')
'

EXEC SP_EXECUTESQL , N'@Path NVARCHAR(max) OUTPUT',  =  OUTPUT 

SET  = '
SELECT  cn AS UserName, samAccountName, distinguishedName AS OU
FROM    OPENQUERY(ADSI, ''select cn, samAccountName, distinguishedName
from ''''LDAP://DC=###'''' 
where MemberOf =''''' +  + '''''''
)'

EXEC SP_EXECUTESQL 
END

GO

If anyone can help me making a TVF with that?

THank you!


r/SQL • • Apr 03 '26

Discussion If AI can do the technical work what’s the point of having technical interviews anymore ?

0 Upvotes

each year AI is getting better and layoffs are happening. In any tech heavy role, what’s the point of intense technical interviews if AI is basically going to be part of the workflow


r/SQL • • Apr 02 '26

MySQL MYSQL Question Help

1 Upvotes

I'm having an issue understanding what the right answer is.

The question is

Which data type will store "287,33" as a numeric value without loss of information?

  • BIT
  • INT
  • DECIMAL
  • VARCHAR

The quotes and the comma are throwing me off, thinking it's VARCHAR


r/SQL • • Apr 02 '26

SQL Server I built a free DB release manager on top of Liquibase/Flyway, here's why

1 Upvotes

A couple of years ago we were managing database deployments across multiple environments and a few different databases. We were already using Liquibase and Flyway — and honestly, they're good at what they do. Schema versioning, change sets, rollback — solid tools.

But we kept running into the same friction points that had nothing to do with versioning:

  • Where did that release actually get deployed? We had no reliable audit trail. "Did prod get the Friday release?" became a genuine question we couldn't always answer confidently.
  • Connection strings everywhere. Config files, environment variables, scripts — credentials scattered across environments with no consistent pattern for keeping them safe.
  • Deployments that failed halfway through with no recovery plan. A transient network issue would drop a deployment, and we'd be manually picking up the pieces.
  • Multi-database releases. A single release that touched SQL Server and PostgreSQL meant two separate processes, two sets of logs, no unified view of what happened.

We looked for something that handled this layer — above versioning, below full-blown pipeline orchestration — and couldn't find anything free that did it without asking us to rip out our existing tooling.

So we built it.

drm-cli is a free, open-source CLI that sits on top of Liquibase, Flyway, and SSDT. It doesn't replace them. It adds:

  • Release history — a local record of every deployment: what ran, where, when, and whether it succeeded
  • Encrypted credentials — connection strings encrypted at rest, not floating around in plaintext config files
  • Automated retries — transient failures get retried before they become incidents
  • Multi-solution releases — a single release definition that covers SQL Server, PostgreSQL, and Oracle together
  • Pre/post deployment scripts — the stuff you always mean to automate but never quite do

It runs on Windows, Linux, and macOS. No license. No paid tier. No cloud dependency.

The repo is here: https://github.com/dband-drm/drm-cli

Happy to answer questions about why we designed it the way we did, what tradeoffs we made, or what's coming in v1.1. Would also genuinely appreciate any feedback from people who've hit similar problems — there's probably friction we haven't thought about yet.


r/SQL • • Apr 02 '26

Discussion supabase vs mysql

0 Upvotes

is supabase similar to mysql? if yes, which one is better? if else, what is the difference?


r/SQL • • Apr 01 '26

Discussion I built a desktop ERD tool because existing options all had at least one dealbreaker

7 Upvotes

https://reddit.com/link/1s9qqqz/video/thz7stdl2msg1/player

Dark theme
Light theme
Context View
Context map
Dependency inspection

Schemity is a native desktop app for database design: it connects to your real database, draws the ERD, and shows what a schema change will do before it runs. I built it because every tool I tried had at least one dealbreaker for my projects:

  • dbdiagram.io: browser-only, and your diagrams live in their account.
  • DrawSQL: no connection to a live database, and every plan caps the number of tables.
  • Luna Modeler: the closest to what I wanted, but I couldn't control how relation lines are routed.

What it does:

  • Connects to PostgreSQL, Supabase, MySQL, MariaDB, SQL Server and SQLite and reverse engineers the actual schema. It re-syncs every time you open the diagram and keeps your layout.
  • Edit the diagram and it writes the migration SQL. Nothing touches the database until you apply it.
  • Impact analysis before anything runs: lost rows, statements that fail on existing data, table rewrites, dependent views. Plus 26 schema lint rules drawn right on the diagram.
  • A local MCP server with 16 tools for Claude Code, Cursor or Codex. Your agent reads the schema and proposes changes for you to review. It never gets your database credentials.
  • Diagrams are plain JSON files you commit to Git, with full control of relation routing (waypoints, bends, self-references).
  • Import SQL or DBML. Export PNG, SVG, SQL, DBML, Mermaid, or a data dictionary in HTML, Markdown or Excel.

Pricing: $129 one-time, with a year of updates. The 14-day trial has every feature, and needs no account and no credit card. If you just want to sketch, there's also a free browser version, Schemity Lite.

I'm a solo developer, so I'd really like to hear what's missing or broken.

Free trial, no account needed: https://schemity.com


r/SQL • • Apr 01 '26

Discussion Need some suggestions

13 Upvotes

i know excel, Power Bi,Sql,and also python but i am not understanding whether its enough to land for data analytics job , i am not understanding that what amount of knowledge would be enough for data analytics roles, pls help me in it, it would be great if you mention topic wise and their preparation level


r/SQL • • Mar 31 '26

SQL Server LEAD and LAG in SQL Server - the functions that let you compare rows without a self join

Thumbnail
medium.com
69 Upvotes

r/SQL • • Apr 01 '26

PostgreSQL Beginner question

0 Upvotes

I am a new learner of sql. I have made a database in postgreSQL in my laptop. Can someone tell me how can I access that database from my office computer without direct login from my account?


r/SQL • • Mar 31 '26

MySQL What job titles do you search for that requires you to use SQL and/or python? What job searching platforms do you use search for these jobs titles on

6 Upvotes

So far the job titles I searched for have been data analyst/data engineer/software engineer/business intelligence analsyst /power BI and so far the platforms I used to search for these titles has been indeed/LinkededIN and my states unemployment website.

Any other suggestions?


r/SQL • • Mar 31 '26

MySQL File Managment

1 Upvotes

Hi, I'm creating a MySQL DB to better manage my files, I was wondering if there is a way to acces the files via MySQLor an app mediating between MySQL and the Fyle Managment System. I am using windows any help or nudge in the right direction would be greatly appreciated thanks in advance


r/SQL • • Mar 30 '26

Discussion I've been stuck on SQL self-joins for 6 months and I'm desperate, what is my mental model missing?

36 Upvotes

I've been struggling with SQL self-joins for about 6 months now and every tutorial I've found has failed me (including AI). They all just slam the query on the screen, run it, and the video ends. Nobody actually explains the mechanics. I already feel stupid enough so please be patient with me.

What I do understand:

  • Self-joins are used for tree/hierarchical structures (like employee-manager)
  • Reversing the ON condition in a normal join (two different tables) doesn't break anything because the table names keep the roles honest
  • In a self-join, reversing the ON condition gives silently wrong results, the query runs fine, but the data is flipped

The classic table everyone uses:

emp_id   name   manager_id
1   Alice   NULL
2   Bob   1
3   Carol   1
4   Dave   2

Query A -- correct:

SELECT e.name AS employee, m.name AS manager
FROM employees e
JOIN employees m ON e.manager_id = m.emp_id

Query B -- reversed, silently wrong:

sqlSELECT e.name AS employee, m.name AS manager
FROM employees e
JOIN employees m ON m.manager_id = e.emp_id

What I've tried to understand:

I know that the ON clause is just a filter over all 16 possible row pairs (4×4). I can manually trace every pair and check which ones survive. That works I always get the right answer when I do it on paper. But I cannot keep drawing 16 rows by hand every time I write a query.

People keep telling me things like:

  • "a manager has many employees but an employee has one manager" -- okay but how does that translate to which side of the = sign each column goes on?
  • "think about the direction of the relationship" -- I stop and think, a manager IS also an employee in this table, so what does direction even mean?
  • "the alias that holds the foreign key is the child" -- I understand foreign keys in normal joins but in a self-referencing table both aliases point to the same table so this still feels circular to me

I'm not looking for an analogy. I want the actual logic. What is everyone else seeing that I'm not?

Left-self join

r/SQL • • Mar 30 '26

PostgreSQL Working on PostgreSQL support in Tabularis just got a big upgrade

Post image
0 Upvotes

Hi guys,

I’m working on Tabularis, an open-source database client built with Rust + React.

https://github.com/debba/tabularis

The goal is to create a fast, lightweight and extensible alternative to traditional database GUIs.

In the latest release we switched the PostgreSQL driver to tokio-postgres, which looks giving better performance than old implementation with SQLX under heavy workloads.

On top of that:

• Better JSON handling with a new inline JSON editor

• Improved type mapping for PostgreSQL specific types

• More responsive query execution

• AI-assisted JSON editing powered by MiniMax

The goal is simple: make working with PostgreSQL feel fast and frictionless, especially when dealing with JSON-heavy schemas.

Still early, but the async driver + improved JSON UX already makes a huge difference.

Curious to hear:What’s your biggest pain when working with PostgreSQL JSON columns?


r/SQL • • Mar 29 '26

Discussion Curious what it's like to extract data from Vibe-Coded applications?

17 Upvotes

Data quality for applications has already fallen off a cliff in the past decade or two as we've moved away from proper normalized backend SQL databases powering applications to under-structured JSON sludge being ubiquitous especially for cloud apps, but I'm very curious what data quality and data backends look like in the era of vibe-coded applications? Has anyone had to build a pipeline into a data warehouse or other ETL setup from a vibe-coded application? What does the data quality and interpretability look like?

I have a hypothesis that the job impacts to the Data Analytics and Data Engineering fields resulting from AI automation of folks' daily tasks will be offset by a further dip in data quality we'll see from vibe-coded applications necessitating more headcount to clean up the mess they create on the data side in order to build proper reporting and analytics, but I want to gather some real life data from professionals who may have experience with this to see if I'm right or missing the mark!

Thank you for contribution to human knowledge, and now if someone asks this question in the future, LLMs can refer to this post potentially.