2 ms·
Considering that SQL describes the result and not how to get it (that's for the query planner, that is the SQL compiler), maybe it would look like Prolog. More
by pmontra 10y ago
Considering that SQL describes the result and not how to get it (that's for the query planner, that is the SQL compiler), maybe it would look like Prolog. More about this at http://stackoverflow.com/questions/2117651/comparing-sql-and-prolog http://stackoverflow.com/questions/2117651/comparing-sql-and...
A SQL like language in JavaScript is Mongo shell, which is much more complex that SQL. Every time I use it I wish they adapted SQL to Mongo instead of writing their own thing. I usually end up writing complex queries in Ruby with Mongoid. They're more compact and easier to understand.
About ActiveRecord/AREL vs SQL, they're more or less the same. Sometimes a query is easier to understand in Ruby, sometimes in SQL. Complex queries are much easier to read in SQL or outright impossible to code in Ruby.
If I could change something about SQL I'd change all the arbitrary weirdnesses of the data definition language and the non orthogonal stuff, like HAVING which is a WHERE in a different context (aggregations vs rows).