Not sure why you added /s; .. SQL is in many ways exactly lile JavaScript. The only way to run your code where it needs to run, but with some things to be desired language wise.
I wish more languages compiling to SQL were more common.
(Not ORMs though they just miss the point entirely..)
Agreed. After spending the better part of a decade watching Hibernate a) fail to scale or b) get confused beyond a third level of association, I find myself writing bare SQL and/or refactoring to implement the repository model. ORMs are great for prototyping or if your data model is simple; beyond that you're better off without them.
Most higher level regular programming languages will allow you to escape to C, and C allows you to escape to assembly, so that's not unusual.
In my experience when you need to escape to raw SQL there is still some kind of query builder employed, which too becomes another "compile to SQL" source.