Re:How and why the Relational Model works for databases
by gadders on Monday January 17, 2022 @06:54AM
(#29965664)
Isn't a "WHERE" clause more intuitive than that?
SELECT c.name, i.number
FROM Invoice i, Customer c
where i.CustomerId=c.CustomerID"
Re:How and why the Relational Model works for databases
by tomnipotent on Monday January 17, 2022 @07:43AM
(#29965974)
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.
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"