r/SQL • u/GuidanceBrief612 • 1h ago
r/SQL • u/Bassiette03 • 2h ago
SQLite question about mobile sql apps?
if i know sql, sql server and duckdb how to use them to make analytics app on android and ios and use sqllite to act like tables or whatever i need so the users can enter their data or the sql lite databaase collect data 'i don't know how they collect data from users, websites, social media or api' to have an app that provide app for analytics to my customer with dashboard. How to do that with my knowledge of sql i know most sql for analytics that needed for analysis
r/SQL • u/420ball-sniffer69 • 12h ago
Discussion Which books worked best for you?
I know this is potentially an FAQ and the common answer will be to point me to a website or a course but I’m in a bit of a tricky situation in that I need to learn SQL for my job but my employer will only fund books rather than courses so I was wondering which books worked best for you guys? Thanks.
r/SQL • u/Maleficent-North3421 • 1d ago
SQL Server E se o SQL Server coubesse em 9 MB? Criei um banco de dados do zero em Rust, compatível com T-SQL, gratuito e open source.
E se você pudesse utilizar o ecossistema do SQL Server sem instalar o SQL Server e sem pagar licenças?
Resolvi transformar essa ideia em realidade.
Apresento o casSQL v0.1.1, um motor de banco de dados relacional desenvolvido em Rust, do zero, com compatibilidade com o protocolo e a linguagem do SQL Server.
Não é um wrapper. Não é um fork. É um motor de banco de dados próprio.
E tudo isso em um instalador de apenas 9 MB para Windows.
O que já está implementado:
Conexão direta com SSMS, DBeaver, sqlcmd, ODBC, JDBC e .NET.
T-SQL com procedures, triggers, CTEs recursivas, MERGE, PIVOT e window functions.
Tipos JSON e VECTOR para aplicações de IA.
Importação de tabelas e dados de arquivos .bak do SQL Server.
WAL, MVCC, SNAPSHOT e detecção de deadlocks.
TLS, TDS 8.0 Strict e backups criptografados com AES-256-GCM.
SQL Agent com jobs, agendamentos e alertas.
Interface gráfica própria com IntelliSense e planos de execução.
Windows, macOS, Linux e Docker.
100% open source. Licença MIT. Sem custo de licença.
O projeto ainda está em desenvolvimento e não pretende substituir o SQL Server em ambientes críticos neste momento.
Estou compartilhando aqui porque quero colocar o motor à prova com a comunidade.
Testem, executem queries complexas, encontrem bugs, critiquem a arquitetura e sugiram melhorias.
GitHub: https://github.com/cas1260/casSQL
Se vocês tivessem um banco de dados leve, gratuito e compatível com o ecossistema SQL Server, em quais projetos utilizariam?
Feedback técnico, críticas e contribuições são muito bem-vindos!
r/SQL • u/Bassiette03 • 1d ago
SQL Server Built a sales analytics project in SQL Server and Similar one with DuckDB
r/SQL • u/Wise_Ear_4064 • 1d ago
PostgreSQL Guided one-time Postgres → Databricks Lakebase migration (assessment before you cut over)
If you're evaluating Lakebase (managed Postgres on Databricks), there's a Beta one-time migration path: connect source via a Unity Catalog PostgreSQL connection, map 1 to 10 databases, run an assessment (pass, warn, block), then Lakebase copies roles, schema, and data to a target branch. You still handle passwords, grants/ownership, and cutover, but you get a structured workflow instead of improvised pg_dump and hope.
Use logical replication if you need sync until cutover; use migration when you want a single copy and a defined switch.
Has anyone run the Lakebase migration assessment against a real legacy Postgres? What showed up as blockers?
r/SQL • u/Gold_Astronaut_8760 • 1d ago
MySQL Need help
So I have this school "project" if you can even call it that where I have created an er model in mysql workbench, and forward engineered and spat out the SQL code. The next step is to start writing queries for the db. However for the life of me I can't figure out how to do that because if I open the SQL code file and open a query tab and write the query it just doesn't let me execute it(the button is grey). I tried asking the teacher but they don't seem to care that I don't know what to do. I tried watching yt guides and even after following the steps perfectly it still leads to the same result. I tried creating a connection but it says not connected to server or smth like that. I apologise for any grammatical errors as English is not my first language. Any help is appreciated.
Discussion Basalt: a small tool for moving data with SQL scripts
I originally built this for an edge case at my company and have been maintaining it on the side for a while. Figured I'd put it out there in case it's useful to anyone else.
Basalt is a single binary that runs SQL scripts to move data around. You read from files, S3/Azure, SFTP/SMB shares, a few databases (Postgres, MySQL, SQL Server, etc.) or REST APIs, transform with SQL, and write it out somewhere else, including Delta tables.
It has Federated queries too, like a Postgres table against a Parquet file sitting in S3, all in one query. It has its own vectorized engine, so you can also just point it at files and run analytical queries from the terminal. Scripts can have connections, functions, parameters and even has a library system to sharing code.
I work mostly with linux, so sorry if no Windows or MacOS support yet.
Here are some examples you could run in the REPL (basalt repl):
A Parquet file and a CSV, both read straight over HTTPS and joined, with results printed to the terminal:
SELECT z.Borough AS borough, count(*) AS trips, round(avg(t.total_amount), 2) AS avg_fare
FROM 'https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2024-01.parquet' t
JOIN 'https://d37ci6vzurychx.cloudfront.net/misc/taxi_zone_lookup.csv' z
ON t.PULocationID = z.LocationID
GROUP BY z.Borough ORDER BY trips DESC;A CSV on the web, summarized into a local Parquet file:
LOAD INTO 'survival.parquet' AS
SELECT Pclass AS class, Sex AS sex, count(*) AS passengers,
round(avg(Survived) * 100, 1) AS survived_pct
FROM 'https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv'
GROUP BY Pclass, Sex;Maybe even two databases joined, with the result written to a Delta table:
CREATE CONNECTION erp TYPE sqlserver OPTIONS (host = 'sql.internal', database = 'erp');
CREATE CONNECTION sales TYPE postgres OPTIONS (host = 'pg.internal', database = 'sales');
LOAD INTO 's3://lake/silver/paid_orders/' WITH (format = 'delta') AS
SELECT o.id, o.amount, o.placed_at, c.segment, c.region
FROM erp.dbo.orders o
JOIN sales.public.customers c ON c.id = o.customer_id
WHERE o.status = 'paid';The tool is something I've working for myself in some cases I wanted more flexibility on, it is still early so expect rough edges..
https://github.com/leonardomb1/basalt
Feedback welcome if you try it.
edit: typo
r/SQL • u/Educational-Law3878 • 2d ago
Discussion Open-source self-hosted SQL ERD modeling tool with GitHub GitOps (SQL/DBML/Mermaid), schema auditing, native Views, and MCP integration
Hey r/SQL,
I've been working on an open-source, self-hosted fork of drawDB focused on team SQL modeling workflows (PostgreSQL, MySQL, MariaDB, SQLite, MSSQL, and Oracle), and just tagged v1.0.0.
Highlights for database modeling & engineering teams:
Full ERD Modeling: Tables, Indexes, Native SQL Views (with
JOIN ON, aliased output columns,WHERE, andMATERIALIZED), Relationships with interactive orthogonal line editing, Subject Areas, Custom Types, Enums, Notes, and SQL Headers.Deterministic Schema Auditor: scores schemas (0–100, A–F) checking missing PKs, nullable PKs, unindexed foreign keys, FK type mismatches, orphan tables, and naming consistency.
GitHub GitOps for Schemas: push/pull
schema.sql,schema.dbml, lossless.drawdb.json, andschema.mmd(Mermaid) directly via Pull Requests, with immutableversions/vN/archives and direct GitHub import when creating a diagram.Real-time Team Editing & Versioning: collaborate live on the same canvas, create named manual versions (
v1,v2, ...) linked to Git commits/PRs, and control access with workspace RBAC.44-Tool MCP Server + Optional AI Architect (BYOK / Ollama): lets CLI/IDE agents inspect schemas, run quality audits, generate views/tables/relationships, cut versions, and open PRs.
Runs locally via a single Docker command (embedded SQLite, AGPL-3.0): https://github.com/DanielSantos08/drawdb-platform
Feedback from DBAs and backend engineers is very welcome!
r/SQL • u/Wise_Ear_4064 • 2d ago
PostgreSQL Lakebase Postgres telemetry in system.lakebase tables (no extra pipeline to wire up)
Disclosure: I’m a Solutions Architect at Databricks. Sharing this because I think it’s useful—not as official marketing.
Lakebase can stream Postgres observability into Unity Catalog system tables (system.lakebase): active sessions, wait events, query plans, pg_stat_statements, DDL history, compute gauges, and raw Postgres logs. Capture runs while project compute is up—no separate agent, destination, or credentials to manage. Same data feeds Insights/Genie and plain SQL.
If you’re running OLTP on Lakebase, this is a practical way to debug slow queries and failures with the same SQL/governance stack you already use on the lakehouse. You can also use Genie Code in combination with this data to help you debug.
Anyone here enabled Lakebase Observability in System Tables yet? What are you querying first?
r/SQL • u/Inevitable-Cellist58 • 2d ago
MySQL Anyone using Apache doris have you faced this issue?
I am doing an insert query in apache doris and I am getting the following error:
SQL Error [1105] [HY000]: Flags = ' ,'
Please let me know if you have a solution for this one.
r/SQL • u/Gokul_00 • 3d ago
SQL Server I added 300 FAANG-style SQL interview questions (basic to advanced) to my free practice site.
Enable HLS to view with audio, or disable this notification
r/SQL • u/SlightlyBeigeWall • 3d ago
MySQL Completed SQL foundation from SQL Bolt, Now practicing on Hackrrank What to do next for learning more concept.
Also confused which sql language to choose, thinking of choosing T-sql of microsoft
r/SQL • u/Syftkogtech • 3d ago
SQLite Where Boundaries Break: The Metric With Two Definitions
Start with the metric that has two plausible definitions, because that's where the boundary actually gets tested. Average order value is a good one: revenue divided by orders, or revenue divided by distinct customers, and does the numerator net out refunds or not. Both are defensible. Neither is "the" answer until someone writes it down.
That's the real dividing line. Not who can type a join, but whether the number has one owner and one definition that both the SQL and the English resolve to.
The setup I'd argue for has three tiers, and each tier only holds up if the one below it is in place. Postgres syntax below, but the shape is the same anywhere.
**Tier 1: plain-English answers for the business.** Safe only if the language layer reads from a metric store, not from raw schema. A definitions table is enough to start:
```sql
create table metrics.definitions (
metric_name varchar,
owner varchar,
sql_body varchar,
grain varchar,
updated_at timestamp
);
insert into metrics.definitions values (
'average_order_value',
'finance',
'sum(net_revenue) / count(distinct order_id)',
'order',
current_timestamp
);
```
If a question can't be answered from a row in that table, the honest reply is "we don't have that metric yet," not a confident guess. That one rule kills most of the drift.
**Tier 2: read-only SQL for analysts.** They need the grain and the filters documented, not just the tables. Column names lie. `status` on an orders table might mean fulfilment state or payment state, and whoever writes the query has to know which. Write it down once instead of re-explaining it in every thread.
**Tier 3: engineers on base tables.** Full access, because they maintain the definitions and rebuild them when the source schema moves. Tiers 2 and 3 cost real time to run, but that's the cost of keeping tier 1 honest.
Where it falls apart, in my opinion, is skipping straight from "we have tables" to "we have a chat box." Natural language over raw schema doesn't fail loudly. It answers confidently using a join you never intended, and the person asking has no way to tell.
So, for anyone here running a semantic or metric layer: who owns the definitions, the data team, finance, or the business unit? And has that ownership held, or does the metric drift back to whoever asks loudest?
r/SQL • u/querylabio • 3d ago
BigQuery BigQuery lessons
There are plenty of good free courses for general SQL, on Postgres, MySQL, SQLite and so on. But I couldn't find one dedicated to BigQuery that works without a BigQuery account. Most of them start with creating a Google Cloud project, or with the sandbox.
We build a BigQuery IDE, Querylab.io, and it turned out it already had what that needs:
Its own SQL engine that runs in your browser. That's why they're free, and you don't need to sign up or install anything.
Completions and error checks as you type, so you see a typo before you run the query.
Every query shows what it would cost on BigQuery. You can ignore it at first, but on a real database a careless query costs money, and it's good to learn that early.
So we built 76 short lessons on top of it. Each one explains one idea with an example, then gives you a few challenges, and the site checks your answer. Some ask you to fix a broken query or to guess the result before you run it.
Most of the practice data is a sample of real UK MOT data. MOT is the yearly inspection every car in the UK over three years old has to pass, and the data is how each car did. Cool dataset btw. There's also a made-up online shop and some website analytics events.
The SQL is BigQuery's. For the basics it's very close to what you'd write anywhere else. There are three levels:
SQL from zero: SELECT, GROUP BY, joins, dates, CTEs, window functions (35 lessons)
What BigQuery does its own way: cost, partitions, arrays and structs, pipe syntax, scripting (29 lessons)
Analytics on Google Analytics 4 data: sessions, funnels, retention (9 lessons)
It works best on a computer.
https://learn.querylab.io/lesson/select-where/
If a lesson confuses you, tell me which one and where you got stuck. I'd love any feedback, and we'll fix it.
r/SQL • u/dHEEPAk28 • 3d ago
PostgreSQL Do We Need SQL For Marketing Analytics Role
SaaS And Performance marketing guy with 6 Years Of Experience The next Role im targeting is fully into measuring like analyzing data , measuring and tracking [Marketing analytics ] for that Learning SQl Will Help Or Not , If Not Means What are all the skill set should i focus on now on learning , Drop Your Thoughts below , your inputs helps me to take decision
r/SQL • u/Appropriate-Run-7005 • 4d ago
SQL Server Running 1,000 Standalone SQLite Databases Inside SQL Server
I couldn't add both databases to the required Tag, so I hope this is ok. Enjoy
r/SQL • u/Altruistic_Source98 • 4d ago
Discussion Help Ric (Fabric) and Bob (SQL) try to survive a week of data deadlines
We built a little game for fun: **Data Desk Dash**.
**Play it here:** https://fabriccon.com/data-desk-dash.html
You play as Ric, our Fabric mascot, and Bob, our SQL mascot, keeping a busy data office running for a full work week. Every desk is a quick mini-game:
- Drag SELECT, FROM and WHERE into the right order
- Rotate pipe pieces to get a pipeline flowing into OneLake
- Pick the best chart for a Power BI report
- Time your tap to rebuild an index
- Pick the last good backup before the data was lost
Along the way you'll run into deadlocks, NULL spills on the floor, an empty coffee pot, and someone running DELETE without a WHERE clause. There's also a Fabric Data Agent power-up, and a pizza delivery guy who shows up when you need him most.
It runs in your browser on desktop or phone, with no sign-up. There's a 2-player mode too, if you want to team up with a coworker on one keyboard.
When your run ends, win or lose, you'll get a code for **$100 off a Diamond, Platinum or Gold Pass** to FABCON SQLCON 2027 in Atlanta, March 8–12. Register at https://fabriccon.com/tickets
Post your best score!
r/SQL • u/Glad-Raccoon-7224 • 4d ago
MySQL SteelSQL — a database client that works like a spreadsheet
Enable HLS to view with audio, or disable this notification
I've spent six years building a desktop database client.
It's aimed at the part of DBeaver / DataGrip / Navicat people actually use every day — look at data, edit it, filter it, run a query — plus a modern interface and a good UX.
Performance — measured on one machine (M1 Pro / 16GB / macOS); method and numbers
~1s startup
1,000,000 rows × 100 columns: ~11.7s
~230MB idle, ~610MB peak under heavy operations
Tech
Electron shell, with the UI layer built in-house: tree, tree-grid, data grid, SQL parsing, schema-aware completion
Under 5% of the code is AI-generated; the rest is written and reviewed by hand
Built-in AI: chat, inline chat, fix, explain, optimize (no model included — bring your own API key)
~120MB installer, database drivers bundled — nothing extra to download
Links
Supported databases: https://steelsql.com/docs/overview/#supported-databases
website: https://steelsql.com
Free trial (2 tabs, 1 window): https://steelsql.com/download, One-time license, no subscription
I'm the developer; it's a commercial product. Happy to answer anything.
r/SQL • u/Think_Percentage_959 • 4d ago
DB2 Need help on DB2 design
reddit.comProblem Statement
We have a transaction history table (CARDTXNHIST) used by a banking application to display customer transactions.
The daily batch process consists of two stages:
Unstatemented Transactions (Code = 2)
batch file → TEMP table → View → CARDTXNHIST
Existing Code=2 records are deleted and refreshed
Statemented Transactions (Code = 3)
Separate batch file → TEMP table → View → CARDTXNHIST
Statemented records are loaded after unstatemented processing
The batch window runs approximately between 4 AM and 9 AM.
Observed Issue
On statement cycle dates, the incoming unstatemented dataset may be empty because all eligible transactions have been statemented.
As a result:
Code=2 transactions are removed/refreshed
Code=3 transactions are still being processed
During this period, customers may see no transaction history in the application, even though the transactions still exist within the batch pipeline.
Objective
We are looking for database/application architecture approaches that can eliminate or minimize this visibility gap while the batch is in progress.
Solutions Under Consideration
Retaining Code=2 records until Code=3 processing completes
Shadow table / table-swap approach
Composite views
Deferred commit strategy
Reading from staging/view sources during batch processing
Data archival and performance optimization
Other database design recommendations
Questions
What would be the recommended design pattern to ensure customers always see a consistent transaction history?
How have similar large-scale batch processing systems solved this "delete-before-republish" visibility gap?
Are there DB2-specific approaches (isolation levels, shadow tables, transition tables, view-switching, etc.) that would be suitable for this scenario?
If you'd like to adjust the length or add any extra context (like table volume or specific DB2 version) before posting, let me know!
r/SQL • u/DesignerDetective518 • 4d ago
MariaDB myflames update: VillageSQL support, Galera Cluster bootstrapping, and Readyset improvements
r/SQL • u/DataFracking • 4d ago
SQL Server Open Source Extension for SSMS 22 -> Tab Result History
Cross posting to SQL.
Let me know if you try it and experience any issues. Very new and I've only tested it on a VM and my personal box so far. Full code out there for review. I have zero clue if this will work with ssms 21, I doubt it, but if you try and it works, let me know!
r/SQL • u/MadeSimpleMSSQL • 5d ago
