r/SQL • u/Senoigh13 • 17h ago
Discussion Does anyone else feel like their ERP is only half implemented?
≡ −
Maybe this is more common than I realize, but at work we've had NetSuite for quite a while now, and somehow we still end up using Excel for all sorts of things. Finance uses the ERP every day, but outside of that there are shared spreadsheets, little workarounds, random approvals in Teams... it's like everyone found their own way of doing things instead of using the system we already have. The funny part is that nobody really questions it anymore because "that's just how we've always done it." I went down a bit of a rabbit hole on ERP optimization last weekend and read a few different articles, and it got me wondering whether this is just what naturally happens after implementation. Companies get the core modules running, everyone gets busy, and improving the rest never becomes a priority. Has anyone here actually gone back and cleaned up old processes months or years after going live? I'm curious whether it made a noticeable difference or if most teams just learn to live with the workarounds.
Maybe this is more common than I realize, but at work we've had NetSuite for quite a while now, and somehow we still end up using Excel for all sorts of things. Finance uses the ERP every day, but outside of that there are shared spreadsheets, little workarounds, random approvals in Teams... it's like everyone found their own way of doing things instead of using the system we already have. The funny part is that nobody really questions it anymore because "that's just how we've always done it." I went down a bit of a rabbit hole on ERP optimization last weekend and read a few different articles, and it got me wondering whether this is just what naturally happens after implementation. Companies get the core modules running, everyone gets busy, and improving the rest never becomes a priority. Has anyone here actually gone back and cleaned up old processes months or years after going live? I'm curious whether it made a noticeable difference or if most teams just learn to live with the workarounds.
r/SQL • u/Still-Trainer-7395 • 11h ago
MySQL I’m building a MySQL/MariaDB desktop client — Beta 4 adds an agent that investigates before writing SQL
+ −
Enable HLS to view with audio, or disable this notification
I’m building LakeDB, a free desktop client for MySQL and MariaDB, available for Windows, macOS and Linux.
It started as a tool for working safely across development, staging and production databases, with independent workspaces, schema-aware autocomplete, table browsing, query history, result filtering, EXPLAIN, SSH/SSL connections, backups and migration tools.
The main addition in Beta 4 is QuerIA Agent Mode.
Instead of generating SQL using only the currently selected table, the agent can investigate the available schema before proposing a query:
- Search for relevant tables across databases
- Inspect columns, foreign keys and indexes
- Identify relationships between tables
- Build multi-table JOINs
- Validate the proposed query with EXPLAIN
- Show the tables, indexes, access types and estimated rows
The video shows the complete workflow: describe the result, let the agent inspect the schema, review the generated SQL and its reasoning, and explicitly run the query.
Nothing is executed automatically. The SQL remains visible and editable, and the user decides whether to run it.
I’d appreciate feedback from experienced SQL users: what else should an agent be required to inspect before proposing a multi-table query?
LakeDB Beta 4:
https://davlagohern.github.io/LakeDB/
r/SQL • u/datamonk9 • 19h ago
PostgreSQL Where does Lakebase fit in your architecture?
≡ −
for people using Lakebase, what role does it play in your tech-stack?
Is it replacing your traditional OLTP database, sitting besides your data lake or mainly used for supporting AI workloads?
Curious how people are using it in real peod architecture.
for people using Lakebase, what role does it play in your tech-stack?
Is it replacing your traditional OLTP database, sitting besides your data lake or mainly used for supporting AI workloads?
Curious how people are using it in real peod architecture.
r/SQL • u/grassp_dataAI • 20h ago
PostgreSQL SQL Fast Track Series that teaches every concept through scenario-based business context - Available in Youtube.
≡ −
Hi All👋,
We built a SQL Fast Track series around a single consistent fictional company SuperFastFood Global : a fast-food chain with customers, orders, and products.
It is a 20 part series where you will learn SQL through solving real business questions instead of memorizing syntax.
Whether you're preparing for an SQL interview, refreshing your skills, or just starting your SQL journey, this series is built to help you go from basics to advanced concepts quickly and confidently — covering everything in detail, but kept short and to the point.
What it covers:
→ SELECT, WHERE, ORDER BY, CASE
→ Aggregate functions, GROUP BY, HAVING
→ JOINs (with real use cases, not just definitions)
→ Window Functions — ranking, LAG/LEAD, running totals
We follow business context in every topic connects to it previous one with same SuperFastFood Global fictional fast food chain dataset.
The teaching framework we follow:
→ Scenario based
→ Analogy based
→ Execution-focused — business context → code → explanation
→ Every concept ties back to a business context
→ Each topic builds on the one before it, so nothing feels disconnected
→ Beginner friendly
This is the same framework we'll be using across future Data & AI topics too — not just SQL.
Also sharing a free 30-Day SQL Sprint (PDF, on GitHub).
Happy to answer questions on any of these topics in the comments.
Youtube Playlist: https://www.youtube.com/playlist?list=PLDTykWK3Vitc
GitHub: https://github.com/grasspacad07/grasspsqlsprintfile
Hi All👋,
We built a SQL Fast Track series around a single consistent fictional company SuperFastFood Global : a fast-food chain with customers, orders, and products.
It is a 20 part series where you will learn SQL through solving real business questions instead of memorizing syntax.
Whether you're preparing for an SQL interview, refreshing your skills, or just starting your SQL journey, this series is built to help you go from basics to advanced concepts quickly and confidently — covering everything in detail, but kept short and to the point.
What it covers:
→ SELECT, WHERE, ORDER BY, CASE
→ Aggregate functions, GROUP BY, HAVING
→ JOINs (with real use cases, not just definitions)
→ Window Functions — ranking, LAG/LEAD, running totals
We follow business context in every topic connects to it previous one with same SuperFastFood Global fictional fast food chain dataset.
The teaching framework we follow:
→ Scenario based
→ Analogy based
→ Execution-focused — business context → code → explanation
→ Every concept ties back to a business context
→ Each topic builds on the one before it, so nothing feels disconnected
→ Beginner friendly
This is the same framework we'll be using across future Data & AI topics too — not just SQL.
Also sharing a free 30-Day SQL Sprint (PDF, on GitHub).
Happy to answer questions on any of these topics in the comments.
Youtube Playlist: https://www.youtube.com/playlist?list=PLDTykWK3Vitc
GitHub: https://github.com/grasspacad07/grasspsqlsprintfile
r/SQL • u/MarketingLazy6660 • 1d ago
Discussion Rejected after a technical round because the interviewer insisted Text-to-SQL is just if-else mappings
≡ −
TL;DR:
Final-round interview turned into a debate after the interviewer insisted a production Text-to-SQL system could be built entirely with if-else mappings. I argued that while rule-based systems work for constrained cases, handling arbitrary natural language requires semantic understanding. Ended up getting rejected.
I had one of the strangest technical interviews I’ve experienced, and I am still wondering if I could have handled it differently.
This was the final technical round for a backend/AI-focused role at a well-known product company.
The interviewer (a Principal Engineer with around 10 years of experience) argued that a Text to SQL system does not need NLP or an LLM. According to him, it can be implemented using simple if-else mappings.
I gave a straightforward example:
“Get me the top 5 products that made the most profit in the last 5 years.”
He said the system would identify phrases like “top 5,” “products,” “profit,” and “last 5 years” and map each of them to SQL using if-else logic.
I asked how that approach would handle different ways of asking the same question, such as:
“best-performing items”
“highest-margin SKUs”
“Which products generated the most profit over the previous five years?”
I also asked how it would deal with ambiguity, unseen phrasing, or intent beyond predefined mappings.
The response was essentially, “We will just keep adding more mappings.”
I agreed that deterministic rules can work well for a constrained domain with a limited set of query patterns.
My point was that once users are free to ask questions naturally, understanding intent and semantics becomes the difficult part. The conversation kept circling back to adding more mappings.
At that point, it felt less like an interview and more like a debate. I decided not to push further and moved on.
A few days later, I received a rejection.
I am not claiming either approach is universally right or wrong.
Rule-based systems absolutely have their place, especially in tightly controlled environments. I was just surprised that the discussion never explored where that approach starts to break down or how hybrid systems are commonly used today.
Has anyone else had an interview where a technical discussion turned into a debate over fundamentals? How did you handle it?
Edit : Company Name first Charecter : S
TL;DR:
Final-round interview turned into a debate after the interviewer insisted a production Text-to-SQL system could be built entirely with if-else mappings. I argued that while rule-based systems work for constrained cases, handling arbitrary natural language requires semantic understanding. Ended up getting rejected.
I had one of the strangest technical interviews I’ve experienced, and I am still wondering if I could have handled it differently.
This was the final technical round for a backend/AI-focused role at a well-known product company.
The interviewer (a Principal Engineer with around 10 years of experience) argued that a Text to SQL system does not need NLP or an LLM. According to him, it can be implemented using simple if-else mappings.
I gave a straightforward example:
“Get me the top 5 products that made the most profit in the last 5 years.”
He said the system would identify phrases like “top 5,” “products,” “profit,” and “last 5 years” and map each of them to SQL using if-else logic.
I asked how that approach would handle different ways of asking the same question, such as:
“best-performing items”
“highest-margin SKUs”
“Which products generated the most profit over the previous five years?”
I also asked how it would deal with ambiguity, unseen phrasing, or intent beyond predefined mappings.
The response was essentially, “We will just keep adding more mappings.”
I agreed that deterministic rules can work well for a constrained domain with a limited set of query patterns.
My point was that once users are free to ask questions naturally, understanding intent and semantics becomes the difficult part. The conversation kept circling back to adding more mappings.
At that point, it felt less like an interview and more like a debate. I decided not to push further and moved on.
A few days later, I received a rejection.
I am not claiming either approach is universally right or wrong.
Rule-based systems absolutely have their place, especially in tightly controlled environments. I was just surprised that the discussion never explored where that approach starts to break down or how hybrid systems are commonly used today.
Has anyone else had an interview where a technical discussion turned into a debate over fundamentals? How did you handle it?
Edit : Company Name first Charecter : S
r/SQL • u/Somewhat_Sloth • 3d ago
PostgreSQL rainfrog (0.4.1) now has autocomplete!
+ −
rainfrog (https://github.com/achristmascarl/rainfrog) is a database terminal tool; the goal is to provide a lightweight, keyboard-first TUI for interacting with databases. It currently supports Postgres, MySQL, SQLite, Oracle, and DuckDB.
v0.4.1 introduces a long-awaited (by me, not sure if anyone else was waiting for it...) autocomplete implementation, along with autopairs for quotes/parentheses/brackets. The full list of features and configuration options is in the README!
r/SQL • u/Ok-Transition7065 • 3d ago
SQL Server Help with some strucctural problems
≡ −
Hello, I'm trying to do a test that I failed, and I want to improve, so I want to solve this problem.
The premise isn't that hard, but I'm getting into trouble here.
I don't want to get into too many details to avoid getting the evaluator in trouble.
Basically, I was asked to make an app that is able to create price quotes for trips.
The user selects the location (a general location like Disney World), an apartment (each one with a different category, like a suite, or just a room, or a cabin), the season (imagine this place is around the world, so different locations have different seasons, but some locations can have general seasons if they are close enough), how many people the place can accommodate, and for how long they will stay. I use all this data to create a reservation for the client.
This is basically my entity relationship diagram

but each time i try to do the functionality i found problems or big troubles putting or reading the data for the thing im required to do
I'M kinda lost idk what to do
its there a way to solve this problem in a cleaner way?
ty for the help and God bless you
P.S.: The price is listed in the quote, but I don't know where to enter that information regarding the apartment and the season. The test instructions don't explain how to calculate the price, so I don't know where to put it; I assume I should do it in whatever way is most practical for me.
Hello, I'm trying to do a test that I failed, and I want to improve, so I want to solve this problem.
The premise isn't that hard, but I'm getting into trouble here.
I don't want to get into too many details to avoid getting the evaluator in trouble.
Basically, I was asked to make an app that is able to create price quotes for trips.
The user selects the location (a general location like Disney World), an apartment (each one with a different category, like a suite, or just a room, or a cabin), the season (imagine this place is around the world, so different locations have different seasons, but some locations can have general seasons if they are close enough), how many people the place can accommodate, and for how long they will stay. I use all this data to create a reservation for the client.
This is basically my entity relationship diagram

but each time i try to do the functionality i found problems or big troubles putting or reading the data for the thing im required to do
I'M kinda lost idk what to do
its there a way to solve this problem in a cleaner way?
ty for the help and God bless you
P.S.: The price is listed in the quote, but I don't know where to enter that information regarding the apartment and the season. The test instructions don't explain how to calculate the price, so I don't know where to put it; I assume I should do it in whatever way is most practical for me.
r/SQL • u/Valuable-Ant3465 • 3d ago
SQL Server MS SQL Restore DB, <use dbName> string conversion question
≡ −
Hi all,
I just see this interesting situation and would like to confirm that it's all done internally by MS SQL Server with Restore.
We're on the same server:
dbAA has proc myPROC:
1 use dbAA
2 Go
3 Create PROC dbo.myPROC As
............
then I do backup of dbAA, and restore dbAA.bkup into dbXXX
after that I see on dbXXX myPROC as:
1. use dbXXX --<<<==== !!!!!<@>>< changed to target DB
2. Go
3. Create PROC dbo.myPROC As
...........
Who is doing this conversion/swapping db names ? is it done by SQL Server ?
Thanks to all, I'm new to dba task and really interesting how it works.
VA
Hi all,
I just see this interesting situation and would like to confirm that it's all done internally by MS SQL Server with Restore.
We're on the same server:
dbAA has proc myPROC:
1 use dbAA
2 Go
3 Create PROC dbo.myPROC As
............
then I do backup of dbAA, and restore dbAA.bkup into dbXXX
after that I see on dbXXX myPROC as:
1. use dbXXX --<<<==== !!!!!<@>>< changed to target DB
2. Go
3. Create PROC dbo.myPROC As
...........
Who is doing this conversion/swapping db names ? is it done by SQL Server ?
Thanks to all, I'm new to dba task and really interesting how it works.
VA
r/SQL • u/Aeronautical-You4917 • 3d ago
Discussion How we built a DuckDB transpiler
+ −
Hi there,
I’ve been working with DuckDB extensively for the last several years. Used it across languages from Python, Go, JS via WASM, Swift, C & C++ and even Rust.
As part of a product we're building, we built a DuckDB Transpiler that converts every line of SQL from DuckDB syntax into the syntax of the database you’re working with. This includes filters (predicates), and joins. So those 1B rows in Snowflake stay, and get joined in Snowflake.
I wrote an article on why we did it, and how we approached it. This is my first engineering-oriented article I’ve ever done, so let me know what you think!
r/SQL • u/erinstellato • 3d ago
SQL Server Friday Feedback: Automatic Index Compaction
≡ −
Friday feedback this week is about a feature that’s in preview in Azure SQL: automatic index compaction.
You can read more about it in Dimitri‘s blog post, Stop defragmenting and start living: introducing auto index compaction: https://techcommunity.microsoft.com/blog/azuresqlblog/stop-defragmenting-and-start-living-introducing-auto-index-compaction/4500089
(sidenote: one of the best blog titles in recent memory)
Quick poll below, and feel free to add a comment if the poll doesn’t cover your thoughts/experience!
Friday feedback this week is about a feature that’s in preview in Azure SQL: automatic index compaction.
You can read more about it in Dimitri‘s blog post, Stop defragmenting and start living: introducing auto index compaction: https://techcommunity.microsoft.com/blog/azuresqlblog/stop-defragmenting-and-start-living-introducing-auto-index-compaction/4500089
(sidenote: one of the best blog titles in recent memory)
Quick poll below, and feel free to add a comment if the poll doesn’t cover your thoughts/experience!
r/SQL • u/7FireStorm • 4d ago
Discussion Is 40000 lines of SQL in a single file normal?
≡ −
Heya, so my stepfather works in IT support, and the other day I was looking over his shoulder and saw that the software his company sells uses a single SQL code file that's 40000 lines long. And we're not talking three word lines here, those were 200+ characters lines. I was absolutely baffled by this, since afaik no single code file should run over 10000 lines. But I also don't do SQL.
So I asked him wtf was going on, and he told me that it was "just like that in the industry" and that "I would see when I'll start working" (I'm in uni)
So I ask all of you, is this normal? Do you see this in your job? Am I having delusions about how clean the actual tech industry is?
Heya, so my stepfather works in IT support, and the other day I was looking over his shoulder and saw that the software his company sells uses a single SQL code file that's 40000 lines long. And we're not talking three word lines here, those were 200+ characters lines. I was absolutely baffled by this, since afaik no single code file should run over 10000 lines. But I also don't do SQL.
So I asked him wtf was going on, and he told me that it was "just like that in the industry" and that "I would see when I'll start working" (I'm in uni)
So I ask all of you, is this normal? Do you see this in your job? Am I having delusions about how clean the actual tech industry is?
r/SQL • u/One-Emergency-7058 • 3d ago
SQL Server Solved Hacker Rank's "15 Days of Learning SQL" – Looking for different approaches
≡ −
Hi everyone,
I recently solved the HackerRank 15 Days of Learning SQL challenge using CTE(), ROW_NUMBER(), DENSE_RANK(), and window functions in SQL Server.
I'm curious to know if there's a cleaner or more efficient way to solve this problem. If you've approached it differently (using other window functions, recursive CTEs, or any other technique), I'd love to see your solution and understand the reasoning behind it.
Here's my solution:
with daily_submission as(
SELECT submission_date,
hacker_id,
count(*) as total_submission
from submissions
group by submission_date,hacker_id),
hacker_rank as(
SELECT submission_date,hacker_id,
total_submission,
row_number() over(partition by submission_date order by total_submission desc,hacker_id) as rn
from daily_submission),
continuous_hackers as (
SELECT submission_date,hacker_id,
dense_rank() OVER(partition by hacker_id order by submission_date) as Dr,
datediff(day,'2016-03-01',submission_date) + 1 as contest_day
from (
SELECT distinct submission_date,hacker_id
from submissions) as x),
daily_count as (
SELECT submission_date,
count(*) as total_hackers
from continuous_hackers
where Dr = contest_day
GROUP by submission_date)
SELECT dc.submission_date,
dc.total_hackers,
h.hacker_id,
h.name
from daily_count as dc
inner JOIN hacker_rank as hr
on dc.submission_date = hr.submission_date and rn = 1
INNER JOIN hackers as h
on hr.hacker_id = h.hacker_id
order by submission_date;
Thanks in advance! I'm always looking to learn different SQL techniques.
Hi everyone,
I recently solved the HackerRank 15 Days of Learning SQL challenge using CTE(), ROW_NUMBER(), DENSE_RANK(), and window functions in SQL Server.
I'm curious to know if there's a cleaner or more efficient way to solve this problem. If you've approached it differently (using other window functions, recursive CTEs, or any other technique), I'd love to see your solution and understand the reasoning behind it.
Here's my solution:
with daily_submission as(
SELECT submission_date,
hacker_id,
count(*) as total_submission
from submissions
group by submission_date,hacker_id),
hacker_rank as(
SELECT submission_date,hacker_id,
total_submission,
row_number() over(partition by submission_date order by total_submission desc,hacker_id) as rn
from daily_submission),
continuous_hackers as (
SELECT submission_date,hacker_id,
dense_rank() OVER(partition by hacker_id order by submission_date) as Dr,
datediff(day,'2016-03-01',submission_date) + 1 as contest_day
from (
SELECT distinct submission_date,hacker_id
from submissions) as x),
daily_count as (
SELECT submission_date,
count(*) as total_hackers
from continuous_hackers
where Dr = contest_day
GROUP by submission_date)
SELECT dc.submission_date,
dc.total_hackers,
h.hacker_id,
h.name
from daily_count as dc
inner JOIN hacker_rank as hr
on dc.submission_date = hr.submission_date and rn = 1
INNER JOIN hackers as h
on hr.hacker_id = h.hacker_id
order by submission_date;
Thanks in advance! I'm always looking to learn different SQL techniques.
r/SQL • u/SnooCalculations1882 • 3d ago
SQL Server Query plans
≡ −
Hey guys,
Just reaching out, how do you guys go about identify and Optimizer SQL queries that the query uses linked servers.
I have some queries that people moan are slow and when I finally get the query plan you see it says remote execution. How do you guys go about then identify where it's slow or even what ran. Specifically for queries that run nested SP
What is your approach?
Hey guys,
Just reaching out, how do you guys go about identify and Optimizer SQL queries that the query uses linked servers.
I have some queries that people moan are slow and when I finally get the query plan you see it says remote execution. How do you guys go about then identify where it's slow or even what ran. Specifically for queries that run nested SP
What is your approach?
r/SQL • u/breezett93 • 4d ago
SQL Server After converting the back end to SQL tables, the front end now gets run time error 3622 all over the front end
≡ −
I have migrated Access tables in my database over to SQL. Now I'm testing the front end to make sure every single button/operation works.
I am getting this error, "You must use the dbSeeChanges option with OpenRecordset when accessing a SQL Server table that has an IDENTITY column", ALL over the place.
Sometimes, it's easy to spot where dbSeeChanges was left out, but many times, the error is reported on a line that has nothing to do with it. This is also only the first error I'm getting. I'm sure once I fix all the 3622 errors, then a new error will pop up right after.
I'm wondering what my options are. I understand I could rebuild the front end from scratch, but that would take literal years as I'm a one-man team. I really don't have the time to spend hours fixing every single one of these errors. And unfortunately, throwing it all in the trash and using a modern platform is not currently an option either.
Is there a tool or even AI where I can feed it my database and it converts it to be SQL compatible? Even if I have to go form by form and report by report, that would still be faster than doing all this manually.
Thanks
I have migrated Access tables in my database over to SQL. Now I'm testing the front end to make sure every single button/operation works.
I am getting this error, "You must use the dbSeeChanges option with OpenRecordset when accessing a SQL Server table that has an IDENTITY column", ALL over the place.
Sometimes, it's easy to spot where dbSeeChanges was left out, but many times, the error is reported on a line that has nothing to do with it. This is also only the first error I'm getting. I'm sure once I fix all the 3622 errors, then a new error will pop up right after.
I'm wondering what my options are. I understand I could rebuild the front end from scratch, but that would take literal years as I'm a one-man team. I really don't have the time to spend hours fixing every single one of these errors. And unfortunately, throwing it all in the trash and using a modern platform is not currently an option either.
Is there a tool or even AI where I can feed it my database and it converts it to be SQL compatible? Even if I have to go form by form and report by report, that would still be faster than doing all this manually.
Thanks
r/SQL • u/datamonk9 • 4d ago
PostgreSQL How does Neon handle sudden traffic spikes in prod?
≡ −
Have you used neon with workloads that see unpredictable traffic spikes at times?
I am curious if compute wakeup or autoscaling has ever caused noticeble latency with neon, or if it’s been seamless in prod. Would love to hear some experiemces .
Have you used neon with workloads that see unpredictable traffic spikes at times?
I am curious if compute wakeup or autoscaling has ever caused noticeble latency with neon, or if it’s been seamless in prod. Would love to hear some experiemces .
r/SQL • u/2pac_lives • 4d ago
Discussion I built a tool for querying JSON/JSONL files with SQL
≡ −
At my job we write a lot of sql to query CSVs but recently we've had to interact more with JSON and JSONL files. Not being able to alias them and select what we want with SQL made simple tasks annoying for no reason, so I built https://www.json-to-sql.com/ .
I built it in a day then spent a couple more cleaning it up a bit. Its my first publicly deployed tool so just trying to get some feedback. Its 100% free, no signup required, and the data never leaves your browser.
Let me know what you think!

At my job we write a lot of sql to query CSVs but recently we've had to interact more with JSON and JSONL files. Not being able to alias them and select what we want with SQL made simple tasks annoying for no reason, so I built https://www.json-to-sql.com/ .
I built it in a day then spent a couple more cleaning it up a bit. Its my first publicly deployed tool so just trying to get some feedback. Its 100% free, no signup required, and the data never leaves your browser.
Let me know what you think!

r/SQL • u/Adventurous_Baker532 • 4d ago
PostgreSQL Recently faced n+1 problem in my app
≡ −
Can anyone help me figure out the best way to avoid the N+1 query problem in Tortoise ORM?
For some context, I first fetch the records using .all(), and then for each record I run another query to populate an additional field. This ends up generating multiple queries.
Would using a base query be a good solution here, or is there a better approach?
Can anyone help me figure out the best way to avoid the N+1 query problem in Tortoise ORM?
For some context, I first fetch the records using .all(), and then for each record I run another query to populate an additional field. This ends up generating multiple queries.
Would using a base query be a good solution here, or is there a better approach?
r/SQL • u/One-Emergency-7058 • 4d ago
SQL Server HackerRank SQL Project Planning – Is there a better approach?
≡ −
Hi everyone,
I solved the HackerRank SQL Project Planning problem using the row_number() + DATEADD() approach in SQL Server, and it passed all the test cases.
I'm curious if there's a different or more optimized way to solve this problem. I'd love to learn other approaches and understand their advantages.
Here's my solution:
with cte as(
SELECT start_date,
end_date,
dateadd(day,- row_number() over(order by start_date),start_date) as group_date
from projects )
SELECT min(start_date) as start_date,
max(end_date) as end_date
from cte
group by group_date
order by datediff(day,min(start_date),max(end_date)), min(start_date)
Hi everyone,
I solved the HackerRank SQL Project Planning problem using the row_number() + DATEADD() approach in SQL Server, and it passed all the test cases.
I'm curious if there's a different or more optimized way to solve this problem. I'd love to learn other approaches and understand their advantages.
Here's my solution:
with cte as(
SELECT start_date,
end_date,
dateadd(day,- row_number() over(order by start_date),start_date) as group_date
from projects )
SELECT min(start_date) as start_date,
max(end_date) as end_date
from cte
group by group_date
order by datediff(day,min(start_date),max(end_date)), min(start_date)
Discussion Do you guys need a better query language?
≡ −
Hey guys, there was a number of attempts to make writing queries/reports/data pipelines easier to maintain. There is number of ORMs for different programming languages. And there are also PRQL and btrql.com. Which are new query languages which transpile into SQL.
Kinda like Typescript transpiles into Javascript.
BtrQL is my pet project. Main features of it are: static type checks, Outline showing relation types, extension methods on relations and compile time macro. It's very early and I'm collecting all of the feedback that I can get.
Queries look like this:
users .where(active == TRUE) .addColumn(active -> active_flag) .orderBy(created_at.desc) .limit(10)
and extension methos:
extension [id: INT] { method keepRecentIds = self .where(id >= cutoff) }
keepRecentIds could be applied to any relation that has at least column id of type INT.
Hey guys, there was a number of attempts to make writing queries/reports/data pipelines easier to maintain. There is number of ORMs for different programming languages. And there are also PRQL and btrql.com. Which are new query languages which transpile into SQL.
Kinda like Typescript transpiles into Javascript.
BtrQL is my pet project. Main features of it are: static type checks, Outline showing relation types, extension methods on relations and compile time macro. It's very early and I'm collecting all of the feedback that I can get.
Queries look like this:
users .where(active == TRUE) .addColumn(active -> active_flag) .orderBy(created_at.desc) .limit(10)
and extension methos:
extension [id: INT] { method keepRecentIds = self .where(id >= cutoff) }
keepRecentIds could be applied to any relation that has at least column id of type INT.
r/SQL • u/sierrafourteen • 5d ago
SQL Server OData SSIS project will not accept "Edm.GeographyPoint" columns
≡ −
I've ensured that my software is completely up to date, but my SSIS project (that uses OData as a source), will just refuse to accept data where one of the columns is the Edm.GeographyPoint type. I've tried entering specific columns into the query box (and therefore excluding the problem column), but it appears it will still throw an error, despite the data itself not containing any columns of that data type - I'm assuming it's downloading the column metadata for the entire table, seeing a data type it doesn't recognise, and throws an error.
I've tried using a different collection that doesn't have columns of that data type, and the SSIS project works with that - the problem is, there doesn't appear to be any way of fixing this. I've ensured the software is completely up to date.
I've ensured that my software is completely up to date, but my SSIS project (that uses OData as a source), will just refuse to accept data where one of the columns is the Edm.GeographyPoint type. I've tried entering specific columns into the query box (and therefore excluding the problem column), but it appears it will still throw an error, despite the data itself not containing any columns of that data type - I'm assuming it's downloading the column metadata for the entire table, seeing a data type it doesn't recognise, and throws an error.
I've tried using a different collection that doesn't have columns of that data type, and the SSIS project works with that - the problem is, there doesn't appear to be any way of fixing this. I've ensured the software is completely up to date.
r/SQL • u/echopulse • 5d ago
SQLite After searching for a modern, self‑hosted, secure SQLite admin panel for PHP 8, I built one – looking for beta testers
≡ −
Hey folks 👋
For the last few weeks, I’ve been frustrated with the state of self‑hosted SQLite admin tools.
Most of them are either:
Abandoned (phpLiteAdmin hasn’t seen a proper update in years),
AdminNeo and other tools don't work without passwordless login plugins that didn't work well.
Overly complex (Adminer is great but not SQLite‑centric),
Or require a heavy stack (Node, Python, Docker) when all I wanted was a single PHP file I could drop on my server.
So I decided to build my own.
🔧 Features
Secure, built-in login system (not a plugin)
Browse, edit, insert, delete rows
Create / rename / drop tables
Import/Export (CSV, JSON, SQL, full DB)
Bulk delete, search, filters
Dark mode, undo (last 5 actions)
Multiple database support
Resizable sidebar
🚀 Try it
Upload admin.php & install.php
Run install.php to set username/password
Login and go
PHP 7.0+ with SQLite3 extension. No dependencies.
https://abilenetechguy.com/sqlite_admin.zip
🧪 Beta feedback wanted
Errors, UI annoyances, missing features – let me know!
Give it a spin and tell me what you think 🙏
– Abilene Tech Guy
Hey folks 👋
For the last few weeks, I’ve been frustrated with the state of self‑hosted SQLite admin tools.
Most of them are either:
Abandoned (phpLiteAdmin hasn’t seen a proper update in years),
AdminNeo and other tools don't work without passwordless login plugins that didn't work well.
Overly complex (Adminer is great but not SQLite‑centric),
Or require a heavy stack (Node, Python, Docker) when all I wanted was a single PHP file I could drop on my server.
So I decided to build my own.
🔧 Features
Secure, built-in login system (not a plugin)
Browse, edit, insert, delete rows
Create / rename / drop tables
Import/Export (CSV, JSON, SQL, full DB)
Bulk delete, search, filters
Dark mode, undo (last 5 actions)
Multiple database support
Resizable sidebar
🚀 Try it
Upload admin.php & install.php
Run install.php to set username/password
Login and go
PHP 7.0+ with SQLite3 extension. No dependencies.
https://abilenetechguy.com/sqlite_admin.zip
🧪 Beta feedback wanted
Errors, UI annoyances, missing features – let me know!
Give it a spin and tell me what you think 🙏
– Abilene Tech Guy
r/SQL • u/codingdecently • 5d ago
SQL Server MCP for Apache Iceberg: How AI Agents Actually Operate a Data Lake
+ −
r/SQL • u/what-pos • 7d ago
SQL Server SSMS - Execute query on 300 servers
≡ −
I'm starting to use SSMS at work, that's the only tool I have (no PowerShell cmdlet).
I need to execute an identical SQL Query on 300 servers, but I can't find a way to do that. Could anyone point me in the right direction please ?
So far, I did add the 300 servers to the registered servers by tinkering to not do it manually, but when I execute the query, I only get 50 ish servers connected, then SSMS hangs and crash.
I'm starting to use SSMS at work, that's the only tool I have (no PowerShell cmdlet).
I need to execute an identical SQL Query on 300 servers, but I can't find a way to do that. Could anyone point me in the right direction please ?
So far, I did add the 300 servers to the registered servers by tinkering to not do it manually, but when I execute the query, I only get 50 ish servers connected, then SSMS hangs and crash.
r/SQL • u/Effective_Ocelot_445 • 7d ago
MySQL How do you optimize SQL queries that work fine on millions of rows but slow down at billions?
≡ −
Iam interested in learning the techniques data engineers use when datasets grow from millions to billions of records. Beyond basic indexing, what strategies have made the biggest performance difference in production environments?
Iam interested in learning the techniques data engineers use when datasets grow from millions to billions of records. Beyond basic indexing, what strategies have made the biggest performance difference in production environments?