PRQL: a simple, powerful, pipelined SQL replacement
SQL has many problems: &quot;from&quot; should come first to help auto-complete; null handling is complicated; the syntax in general is weird. Compatibility is a problem (I have implemented some relational databases in Java: Hypersonic SQL, H2; compatibility with other databases is hard).<p>There is little innovation in the database space: there are hundreds of general-purpose programming languages, but very few &quot;database&quot; languages. I also tried to specify a new language, <a href="https:&#x2F;&#x2F;newsql.sourceforge.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;newsql.sourceforge.net&#x2F;</a> many years ago. There&#x27;s GraphQL, but more innovation in this area would be great.<p>Many developers end up writing huge SQL statements (one statement that is hundreds of lines). You wouldn&#x27;t do that in a &quot;proper&quot; programming language; but in languages like SQL (or maybe Excel) this will happen.<p>Another problem is proper encapsulation. Views can be used, but often developers have access to all tables, and if you have many components this becomes a mess. Regular programming languages have module system and good encapsulation. SQL statements often don&#x27;t use indexes, for one reason or the other. With regular programming languages, it is harder to end up in this position (as you have to define the API properly: encapsulation). Regular programming languages don&#x27;t require &quot;query optimizers&quot;.<p>SQL is used to reduce network roundtrips. Clients send SQL (or GraphQL) statements to the server, which are actually small programs. Those programs are executed on the server, and the response is sent to the client. (Stored procedures and for GraphQL persisted queries can be used - but that&#x27;s often happening afterwards.) Possibly it would be better to send small programs written in a &quot;better&quot; language (something like Lua) to the server?