4 ms·
The functionality of SQL is great but I really wish it would like more look like other programming languages. I wonder how SQL would look like if someone would
by maxxxxx 10y ago
The functionality of SQL is great but I really wish it would like more look like other programming languages. I wonder how SQL would look like if someone would design it now.
It also should integrate easier with other languages. Using SQL from C# or C++ is a real pain with tons of casts and string manipulation. Better debugging would also be nice.
- skissane 10y ago> The functionality of SQL is great but I really wish it would like more look like other programming languages. I think it looks a lot like COBOL :) Which isn't surprising given it was designed by IBM in the 1970s.
- bluetwo 10y agoWow. I'm surprised at the negative thoughts about SQL. I didn't realize I was an outlier. I'm grateful that it doesn't look like other languages. The format it uses is really easy to generate using other languages, which makes it really useful in a lot of what I do.
- pmontra 10y agoConsidering 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).
- dx034 10y agoI found that SQL is actually an excellent language for people with no coding background. Especially in the BI field it's easy to teach people SQL so that they can perform their own (often quite powerful) queries. It's much easier than learning a proper programming language. A re-design might be nice for programmers, but would likely lock out most people with no programming backgrounds who work on databases.
- maxxxxx 10y agoMaybe simple queries like "Select where" are intuitive for non-programmers but once you start joining tables things get pretty ugly. Also, the syntax for UPDATE is totally different from INSERT although they do similar things. Why does UPDATE use key value pairs but INSERT uses list of column names followed by list of values? Since Javascript is the best programming language ever (so I hear :-) ) maybe using Javascript syntax and objects would be nice.
- dx034 10y agoI absolutely agree that INSERT statements should use key value pairs. It would eliminate many errors where columns were switched accidentally.