Hacker News new | ask | show | jobs
by Sankozi 1608 days ago
"SELECT whatever FROM thisplace" is trivial to improve and could be for example thisplace[whatever].

With joins it gets more complex but still SQL could allow using foreign keys and having SELECT at the end. You could get at least something like:

"FROM Invoice i JOIN i.customer c SELECT c.name, i.number"

instead of

"SELECT c.name, i.number

FROM Invoice i

JOIN i.customer c ON i.CustomerId = c.CustomerId"

1 comments

Isn't a "WHERE" clause more intuitive than that?

SELECT c.name, i.number

FROM Invoice i, Customer c

where i.CustomerId=c.CustomerID"

I prefer JOIN clauses because it makes it easier to reason about the underlying implementation (hash/sort-merge joins) than thinking about cartesian products. It's also much harder to screw up the ON predicate and actually cause a cross join.