r/SQL • u/yughiro_destroyer • Jul 06 '26
Discussion Why do we need abstractions over SQL?
When I mean abstractions, I mainly mean OOP and ORMs.
SQL is so simple and beautiful. Tables with rows and columns are easy to understand. And once you pick up the SQL syntax, you can pretty much achieve anything with queries. Not to mention that SQL is universal and works everywhere and anytime.
Then you have the software development world... where you're asked to constantly use ORMs or map records as OOP objects. Why? ORMs are limited and do not have the flexibility of simple queries. Also mapping records as objects increases bloat, reduces performance that can hurt if the application grows and is overall not as straightforward to work with.
The only good things that ORMs are doing by default are to provide data safety and prevent SQL injection. But with some minimum and basic knowledge and discipline, you can write pure queries without having those problems. Any ideas?
View all comments
Show parent comment
1
u/jshine13371 Jul 07 '26
Not sure what you're trying to say in your first couple paragraphs.
Ok, putting aside the dramaticness of calling them disasters and taking you at face value, again no different than similar quirks in other application layer languages like JavaScript and its
==vs===, null handling, and loose type management.Some of what you said do, some don't. Again, no different than any application layer language with its quirks.
Irrelevant statement?
Personally and professionally I'm a Principal Software Engineer with over 15 years experience and a Computer Science degree, so I understand the full stack. Not just some self taught Data Analyst. I've also just been lucky enough to have learned and gained great experience in the database layer, having worked heavily with all kinds, sizes, and shapes of data.
The only Stockholm here is you doubling down on your subjectivism instead of being able to refute my objective replies to the points you tried to make, such as the ability to performantly implement conditional join logic (again, for those who know what they're doing). 🤷♂️