Another huge win for SQL is that it's easy to construct from parts. You can very easily run and debug your subquery or common table expression on its own before combining it into a larger, more-complex query. If you (as I usually do) create plenty of views while analysing a dataset, the approach can be extremely powerful.
Doing the same in JavaScript is possible, but it's slow and cumbersome by comparison.
Doing the same in JavaScript is possible, but it's slow and cumbersome by comparison.