expr
Really? They're everywhere where I live.
Heh yeah that's pretty straightforward:
SELECT a.*, COALESCE(b.some_col, 'some_default_val') as b_result
FROM a LEFT JOIN b ON (a.id = b.id);
This will produce at least 1 row for every row in a, and if a.id doesn't match any b.id, the value of b_result will be 'some_default_val'.
Not sure if that's exactly what you were describing (since it was a little ambiguous), but that's how I interpreted it.
Ultimately it's just a matter of investing a little time to learn it. It's not fundamentally difficult or complex, even though you certainly can write very complex queries.
To be honest, it's remarkably simple for what it's doing. There's a ton of details that are abstracted away. Databases are massively complex things, yet we can write simple queries to interact with them, with semantics that are well-understood and documented. I think, like anything else, it requires a bit of effort to learn (not a lot, though). Once you do, it's pretty easy to use. I've seen many non-technical people learn enough to write one-off queries for their own purposes, which I think is a testament to its simplicity.
You seem to have missed the part where I said "unless there's imminent danger".
It doesn't arbitrarily double rows or something. For each row in the relation on the left of the join, it will produce 1 or more rows depending on how many rows in the relation on the right of the join match the join condition. The output relation of the join may have duplicate rows depending on the contents of each joined relation as well as what columns you are projecting from each.
If you want to remove duplicates, that's what DISTINCT is for.
That's the whole point of a left join? Anything else wouldn't be a left join anymore.
No variables, no functions
Every major SQL implementation includes both of those things. Of course, it's rarely needed or desirable if you know how to properly write SQL.
"So why can't you do that with expressions?"
You can alias expressions.
And then you try put a MAX in a where and it won't let you because you gotta pull all the maxes out in their own query, make a table, join them in, and use them like a filter...
Wtf are you talking about? For one, filtering by the output of an aggregate is what the HAVING clause is for. But even if that didn't exist, you could just use a subquery instead. You don't need to make table...
Tbh it just sounds like you don't know SQL very well. Which is fine, but doesn't make for a very compelling criticism. SQL does have warts (even though it's great overall), but none of what you described are real problems.
Yep. Postgres rocks. No idea why anyone would bother with anything else. They all suck in comparison.
Nope. Yelling isn't okay. Parents are human and may do it anyway, but it's always a mistake and should be treated as such (except in the case of danger as mentioned above). It absolutely should be avoided as much as possible. It's an incredibly harmful thing to do (for any relationship, actually).
Yelling is never okay unless there's imminent danger and yelling is needed to prevent it.
I've seen it posted before. It's generally anti-AI content, as far as I've seen.