Great question. General-purpose programming languages and query languages have entirely different objectives and don't mix well. In practice, SQL is a high-level messaging protocol used to communicate between two processes (client <-> server) or two modules within a single process (client <-> embedded DBMS).
I worked with several operating systems that included a native programming language and a built-in DBMS: DEC-MUMPS (MUMPS) and IBM OS/400 (RPG). The facilities for database queries in these languages were much better than embedded SQL.