Plain transpiling won’t work because when you write a SQL query, you have to know what engine is running it because they all do worse at some things than others.
For example, the same result could be fetched using a correlated subquery, a common table expression, a temporary table, a view or very hackily using aggregation and it would depend on whether you were using SQL Server, Postgres, MySQL, or SQLite because they don’t do it all fast. …and you need to know the version.
This might be able to be solved if the language was a brand new higher level one though and the compiler knew the intricacies of each engines.
For example, the same result could be fetched using a correlated subquery, a common table expression, a temporary table, a view or very hackily using aggregation and it would depend on whether you were using SQL Server, Postgres, MySQL, or SQLite because they don’t do it all fast. …and you need to know the version.
This might be able to be solved if the language was a brand new higher level one though and the compiler knew the intricacies of each engines.