r/SQL • • 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?

34 Upvotes

103 comments sorted by

View all comments

Show parent comment

1

u/NoYouAreTheFBI Jul 15 '26

Yes you thought wrong. You said a thing that you thought, and it was wrong. Do YOU have a conprehension deficiency?

You can't speak for others. Also you can code 300 lines in a CTE block... if the end statement doesn't call it, the engine optimises it out.

Materialisation is an affirmative action. That's the be all and end all. The default is no materialisation.

What people believe is irrelevant and we can't comment on what others may or may not believe.