r/SQL • u/tombarrett82 • 6d ago
SQL Server SSMS 22 extension skill
Reposting to this group in case others are interested, thanks
r/SQL • u/tombarrett82 • 6d ago
Reposting to this group in case others are interested, thanks
r/SQL • u/MadeSimpleMSSQL • 6d ago
r/SQL • u/FunAd6672 • 6d ago
I'm an inventory planner and I've been writing my own queries against our Postgres reporting replica for about a year, mostly joins, GROUP BY and the odd subquery. I'm moving onto the analytics team in March and work is covering a course before then. The analysts there use window functions and CTEs everywhere, and I can read them but couldn't write one cold. Which SQL topics come up day to day in analyst work, and which can wait?
r/SQL • u/Plane_Big_5912 • 7d ago
i'm working on an automated SQL grader on DuckDB for a game. pass/fail grading is the straightforward part. explaining why a wrong query is wrong is getting difficult, because "93 rows, expected 13" doesn't really tell a player much.
guessing the mistake from the SQL text didn't work for me, there are too many ways to write the same thing. so the checker only uses the query to list candidate edits (each join, each aggregate). the data decides:

the screenshot: "users with a completed deposit and zero withdrawals, each user once". the join to deposits repeats a user once per deposit, so one user shows up 11 times. the panel names the key and the repeated rows.
the one i was stuck on until this week: fan-out that shrinks the result. one audit problem compares SUM(fills.quantity) > SUM(orders.quantity) after the join, so the order side gets inflated and the query returns fewer rows than it should. my inflation check never fired, because nothing was inflated in the output.
what ended up working: first a cheap probe per joined table, count(t.rowid) - count(distinct t.rowid), to see if that table's rows repeat at all after the join. if one does, rewrite each aggregate over it so every source row counts once (in duckdb: list_sum(map_values(map_from_entries(list(distinct row(t.rowid, x)))))), rerun, and require an exact match like the other edits. it hasn't misfired on the problems i've run it on, but that's my own test set, so take it with salt.
two things i'd like input on:
r/SQL • u/IntelligentMirror646 • 6d ago
I’m working on a database project for a metro system, and I’m not sure if my Train table satisfies 3NF.
I think Capacity depends on TrainModel rather than TrainID. If I enter different capacity values for trains of the same model, would that solve the problem, or would it still violate 3NF?
Should I remove Capacity from the table?
r/SQL • u/ResistPast3564 • 6d ago
I've got Postgres with a Redis cache in front. The app deletes the cache key after it updates a row, and that part works. What I'm unsure about is everything else that writes to those tables:
None of those go through the app's update, then delete the key path, so as far as I can tell, the cache just stays stale until the TTL runs out.
How are you handling this? Do your jobs and scripts clear the cache too, do you rely on the TTL, or did you move to something based on logical replication or Debezium? Has one of these other writers ever bitten you?
r/SQL • u/AlarmingCountry4987 • 7d ago
I need help. I worked as a part-time pl sql developer supporting the l2/l3 line system, I was on maternity leave for 2 years, and during that time a lot has changed in the company and in technology, AI has spread a lot. I want to sort everything out in my head, but I don't understand where to get the information from, it won't do to ask the manager, I'm interested in developing in this area and catching up, but I don't understand where to start. I'm waiting for advice, maybe there is a map, etc. Or a brief overview of how things have changed. I hope my request is clear.
r/SQL • u/OracleAbrahamIsa • 7d ago
Senior Oracle DBA here. I put together a short read-only SQL script that reports instance uptime, top 10 wait events, top 10 SQL by elapsed time, tablespace usage, and tables with stale stats. It takes under a minute and it's the same first pass I run every morning. I'm considering packaging a fuller version (70-point check, explain plans, temp/PGA history, restore drills) as a paid pack. Before I build it: which checks do you run first in the morning, and what would a ready-made pack need to include to be worth $29-49? Happy to share the sample script here if there's interest.
r/SQL • u/Eastern-Stable-7576 • 8d ago
i wanted to practice sql and to be able to answer qns , i have noticed that i am struggling a bit when there is two tables give and the qn has to do something with joins and all , in theory i understand how the joins work but i am unable to implement it .I need resources which can help me in advancing my sql like CTE and window function . Is there any youtube channel or anything which will help
r/SQL • u/Temporary_Papaya1058 • 8d ago
r/SQL • u/landry_kb • 8d ago
I grade AI models on data questions for a living experiment, and the same three mistakes keep showing up. Here's a pocket version: paste it into whatever AI you use and see how it does. The database is SQLite.
sales (sale_id, amount):
1: 412.75 · 2: 268.40 · 3: 529.99 · 4: 145.20 · 5: 876.10 · 6: 233.65
7: 694.30 · 8: 358.55 · 9: 921.00 · 10: 187.45 · 11: 543.80 · 12: 476.25
returns (sale_id, one row per return event, 25 rows):
2, 5, 9, 2, 7, 3, 2, 11, 5, 12, 9, 4, 2, 7, 10, 5, 1, 9, 12, 4, 11, 8, 10, 13, 13
Task: write SQLite SQL returning exactly two columns: returned_sales (how many sales came back) and total_returned_sales (their total value, each sale counted once), and state the two numbers.
Answers, so you can grade it yourself:
Pass: 11 and 5,413.79, exactly two columns, SQL SQLite can run.
Trap 1: a total of 11,860.19 means it joined and summed, so sale 2 was counted 4 times. Counted twice (or four times).
Trap 2: a count of 12 means it counted sale 13, which is in returns but was never sold.
Trap 3: FETCH FIRST, EXTRACT, or more than two columns: wrong database or didn't follow the order.
On the full-size version of this case (500 return rows, 99 sales returned more than once), the counted-twice error invents $31,490.03. I've watched a model miss it twice in graded matches.
Curious what yours answered. Post the number it gave.
r/SQL • u/Wooden-News-962 • 9d ago
r/SQL • u/SheepherderAny1 • 9d ago
Curious how much this has shifted lately — feels like more people are moving across different types, but maybe that’s just my bubble. If you picked Other or switched recently, what made you switch?
r/SQL • u/Minimum-Ad7352 • 9d ago
Different DBMSs have their own functions and features. For example, PostgreSQL supports every() function, which isn't available in MySQL.
Is it better to stick to standard SQL as much as possible, or should I take advantage of DBMS-specific features? What are the benefits of staying close to the SQL standard?
r/SQL • u/Lazy_Public_163 • 9d ago
I would like to begin tutoring SQL to earn some money. I'm not exactly sure where to start though. I don't want to just tutor SQL, I'd like to do Python as well. Should I aim for a specific niche or just teach it zero to hero style?
r/SQL • u/harulogs • 9d ago
About a month ago, I posted my SQL client, DBerio, here and asked for feedback. A lot of you took the time to reply, and your comments helped shape this update. Same disclaimer as last time: I'm a solo developer from Korea, this is self-promo, and I use a translator to write.
Things you asked for
Other changes
Searchable query history across connections and a side-by-side diff of two result sets are still on my list. I haven't finished them yet.
Since 1.2.0, the app sends basic usage statistics: days opened, app version, OS and language. It never sends query text, connection details, table names or data, and you can turn statistics off in Settings.
DBerio is available on Mac and Windows and supports MySQL/MariaDB, PostgreSQL, SQLite and Redis. The free version includes every feature, with up to 3 saved connections and 2 open at once.
If you find a bug, notice something that feels off, or have a feature in mind that would make you switch, please comment here or send me a DM. The fixes above started with comments like those, so please keep them coming.
r/SQL • u/Spiritual_Ganache453 • 9d ago
It was my belief in the beginning of 2025 that this project would help ppl who work with databases. There were three main ideas I thought should be different from how it's been done for decades:
What's you perspective on this in 2026?
r/SQL • u/Davenmar • 9d ago
I had an interest with sql when mentioned by a minor subject of mine and its relation to my current major management accounting. I would like to learn and add that to my future resumé but I can help but feel its useless now because of AI where english words are automatically translated into codes. So is there a demand for this in the future? Or should I focus my resources elsewhere?
r/SQL • u/DataFracking • 9d ago
Hey, I've posted before on some of my custom TDS listener stuff. All custom TDS wire protocol in c#. I think this one is probably my most useful one so far. I had posted one earlier on the first cut TTL mode, but this demo covers the more sophisticated one, the change tracking mode.
Full Open Source Code (MIT): https://github.com/TroBeeOne/DaffyZoom
Nuget Install and Instructions: https://www.nuget.org/packages/Daffyzoom
Hour long podcast on how it works (it's ~98% correct but it made a couple mistakes): https://www.youtube.com/watch?v=mwMDmuLjCCY
What it does:
- It solves the problem of 1000+ repeated slow queries that are hitting stale tables. It also helps you identify those slow queries so you can 'actually fix' the indexes, plans, the proper way.
- Sits on the wire in-between client and SQL server
- On the return from SQL Server message it tee's the call, one sync back to client, another async to my caching system. If a repeat query (above 5 second default setting) if tables haven't changed, it now returns instant cache, 0 seconds. if table changed? it reruns the 7 second query and updates the cache on the way back..
- I have data warehouse mode, ttl, just caches everything repeated. with expiration.
- I have change tracking mode (this is the demo I'm showing today). This caches unless a change is made, then it runs the query as normal and refreshes cache.
- Change Tracking Mode requires change tracking enabled on target tables for repeated query. You might think, well, we're now hitting SQL Server 2 times? Yes, but the check is a microsecond. And if you're serving cache from a 10 second query instantly, and ppl are hitting that report at 8am 1000 times, you saved some compute time and made your clients super happy!
- I DO support Entra Service Credentials, but I do not support MFA. I also don't support kerberos yet, I could, but that would require me setting up a domain controller VM, and with little interest so far, no incentive.
Anyway, I haven't tested this in a major production environment yet, so if you do choose to try it, as with anything, test it well and let me know if you find issues.
Here's the demo, cheers. If you try it and run into questions or have issues, let me know. It only caches long queries. It doesn't poll SQL Server for all queries, only the slow ones. It doesn't cache things with getdate() or CRUD related operations obviously. Its all in the documentation / code.
r/SQL • u/Big-Somewhere-7132 • 10d ago
I'm currently learning SQL Server and exploring Azure SQL Database. I have created a few databases for practice, mainly to practice SQL queries, tables, relationships, stored procedures, and other database concepts.
I'm curious about the actual monthly cost of running a few small databases on Azure.
I have a few questions:
How much does it cost monthly to host 2–3 small Azure SQL databases?
Do databases incur charges even when they are not being used?
Is there any free tier or student offer available for Azure SQL Database?
Which is cheaper for learning purposes: DTU-based pricing, vCore, or Serverless?
Can Serverless automatically pause the database when it's idle and significantly reduce costs?
Are there any hidden or additional charges for storage, backups, or other services?
Is it possible to use Azure SQL for practice without spending much money?
I am looking for real experiences from people who have used Azure SQL Database, especially students, developers, or beginners who use it for learning and personal projects.
I would also appreciate it if someone could share their approximate monthly bill for a small database setup and suggest the most economical option for a beginner.
Thanks in advance!
r/SQL • u/SippingOnLean4 • 10d ago
r/SQL • u/thisismugisha • 9d ago
r/SQL • u/shdw_0x0 • 9d ago
I understand how joins work in SQL, but I've always wondered why we need so many variations like INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN.
At the end of the day, we're just joining two tables based on a condition. Is the difference mainly about deciding which rows to retain when there isn't a match, or is there more to it than that?
Curious how others think about this, especially when working with real-world queries. Is there a particular join type you find yourself using most often, and why?
r/SQL • u/clakshminarasu • 10d ago
One of the Sqlserver tables had an int identity column and maxed out the value. Team planned to reseed the identity from the lowest-ve value so that it can run on the same datatype for another 5 or 6 years. I am thinking that this would be a costly mistake if they plan to migrate this data into a new platform. The original solution was to change this to a bigint. Since this field has 300+ fks all those need to be dropped and recreated. What could possibly go wrong by choosing a -ve value reseed? I see the daily seed count is topping approximately 1 to 1.5million ids.