You might be interested in Q, which is the query language for kdb:
[1] https://en.wikipedia.org/wiki/Q_(programming_language_from_K...
It may be great to have a functional language which will write you an SQL query, but I have a hard time to image how else are you going to use a language for describing immutable data structures to edit mutable things.
Maybe you will be interested in Erlang as a functional way to manage something as mutable as network stream.
Maybe you need to learn about array programming languages (APL, J, K). They say about SQL as "to suck data throw a thin pipe" after APL experience.
Maybe you will like dealing with pure AST (I'm talking about Lisp) with no databases at all.
Based on your comment about composability, I'm assuming that's what you actually meant by "functional"? Perhaps you want maps & folds over queries?
What about https://docs.datomic.com/on-prem/query/query.html
and more generally
https://en.wikipedia.org/wiki/Datalog ?
(Around 2010 I was frustrated with the state of OWL/RDF/SPARQL and all that and was curious about Datalog and found it was truly obscure and hard to find good reading about, interest in Datalog has exploded since then.)
Note SQL has subqueries and in some sense is "composable", there are even some advanced features like
https://www.postgresql.org/docs/current/queries-with.html
it is ugly as hell and has problems with consistently using unique names (like the "hygenic macro" problem) but you can write crazy-complicated queries in SQL.