16 ms·
Because relational databases are very good at (surprise!) relations. So in SQL you can query data from several joined tables, query only certain columns, aggreg
by rob74 5y ago
Because relational databases are very good at (surprise!) relations. So in SQL you can query data from several joined tables, query only certain columns, aggregate columns etc. etc. And all of these things are made needlessly complicated by using ORM. Even with the best ORM, you still have to learn an arcane new syntax for stuff you could write in 30 seconds when using SQL...
- nauticacom 5y agoRight, but for most of that stuff I can just write a one-off query, munge it into the ORM's objects and pass that off to my view for rendering. But probably 80% of my queries are "get this object by ID" or "get these objects and some related ones by a simple condition" or maybe a slightly complex condition. In these cases an ORM works wonders and has almost zero downsides
- hello_moto 5y agoORM has escape hatch so you can write SQL for the complex queries (and hopefully don't open yourself to SQL injection along the process) and still benefit from ORM for the simple to moderate case. > So in SQL you can query data from several joined tables Can do that in your ORM too. > query only certain columns So far no issue with ORM