Does anyone using JOIN USING (cols)
? I didn't even realize it was a thing until yesterday 😐
Same here. I learn this, like 6 months ago.
We sometimes do, although sparingly.
Sometimes, although not in my Clojure code atm
I can't, I think you'd need a DB that used full length primary key names for that to be useful. E.g., your "projects" table having a primary key of "project_id" instead of "id"
It doesn't have to be a primary key - can be any column where the names (and type!) are the same
Yea, I understand, but I figured primary keys and foreign keys be the main use case
Agreed 🙂
We have a lot of joins which could use that, although we don't right now. We have multiple keys from different places, so joining them up like that is natural.
Apparently HoneySQL 1.0 supports this (I just found some tests for it) so now I have to make HoneySQL 2.0 support it 😐
I don't think we have a single JOIN anywhere in our codebase where the column names are identical... it's nearly always on sometable.id = thistable.sometable_id
I do sometimes wish we used sometable_id as the column name even in sometable, having columns named 'id' can result in some ambiguous keys in maps (didn't know about USING either)
Yeah, there's definitely some pros to consistently using <table>_id
even for the PK of <table>
...