4 ms·
> I used to have a copy of "SQL for Dummies" at hand whenever I, with dread in my heart, needed to write some SQL, especially if there was any funky stuff like
by michelpp 7y ago
> I used to have a copy of "SQL for Dummies" at hand whenever I, with dread in my heart, needed to write some SQL, especially if there was any funky stuff like joins and such going on.
SQL isn't so much a programming language as a query language. It never claims to be an efficient way to write a factorial function.
And why do people freak out when they see a JOIN? It's one of the simplest concepts in databases: intersecting two sets. Everything in column A that matches everything in column B. You don't even have to concern yourself with the most optimal way to do it, just say it!
- protomyth 7y agoI get the feeling that people would benefit from learning relational algebra before learning SQL. It would give them a basic mental model that would reduce problems with operations like join and provide a nice base to build the more complex SQL mental model.
- irishsultan 7y ago> And why do people freak out when they see a JOIN? It's one of the simplest concepts in databases: intersecting two sets. Everything in column A that matches everything in column B. Actually no, that's not what a join is. A join is a cartesian product (not an intersection), followed by a WHERE clause (which doesn't have to be an exact match of a value between columns). This is further complicated by outer joins where empty rows are added to one or both of the sets involved in the cartesian product.
- michelpp 7y agoOnly a CROSS join is a Cartesian product which is rarely used.