upvote
It is the language's fault, because SQL offers no good way to get nested results. If you want to avoid the duplication, you can do multiple queries, but then you essentially have to do the join on the receiving end, which kind of defeats the purpose of having joins in SQL.

Alternatively, you might use functions to aggregate in the query, but they're not standard, as far I know, which means that interfaces in programming languages often do not support them. The best bet might be aggregating into JSON, but this removes quite a bit of the type information that values in SQL usually carry. (Also, the aggregation functions are generally less pleasant to write than standard joins.)

reply
Yeah, ARRAY_AGG being an optional part of the standard is annoying, and in general the array handling functions have been very non-standardized and messy - it's getting better though!
reply
It minimizes data storage duplication, but not reading. The language does not have a simple way to receive unique records across N-1 joins.
reply
No, that's still the SQL languages' fault because you cannot return multiple tables in a single query.

Half the reason why ORMs have trouble has to do with the fact that you need to fetch has many relations via a second select.

Beyond that, it's the GPPL languages' fault that it doesn't support object or class fragments which are needed to support queries that return a subset of an object.

If people bothered fixing these two issues, then ORMs would be great.

reply