3 ms·
join purchase using (customer_id) They only get cumbersome when you have schemas without consistent key names, complex join conditions, insist on uppercasing r
by hipadev23 2y ago
join purchase using (customer_id)
They only get cumbersome when you have schemas without consistent key names, complex join conditions, insist on uppercasing reserved words, or do all sorts of formatting acrobatics.
So I guess I agree with you. A well designed schema makes reading and writing SQL a pleasure
- rbanffy 2y ago> insist on uppercasing reserved words, It makes code a lot more readable
- williamdclt 2y agoAs someone who does uppercase SQL, I’m not really convinced it improves readability. We don’t do it for other languages after all, syntax coloration is deemed enough. (On the other hand, sql is often embedded in other languages where it might not get properly coloured so… maybe)
- rbanffy 2y agoNot all languages allow it, and most sexy languages forbid it by being case sensitive with their keywords. I've used this feature in Pascal and Basic and my feeling is that it improves readability a lot, as it better highlights structure than just coloring. OTOH, I've used it mostly on monochrome 1-bit-per-pixel systems where coloring wasn't available. I believe it could be a matter of taste.
- arkh 2y ago> customer_id It's hard to fight for those when surrounded by ORM first people. "Why call it customer_id in the customer table, call it id". Because I like using using. "But we don't care we rarely do SQL queries, why optimize for the rare cases?". Enjoy your N+1 ORM only problem then.
- hipadev23 2y agoYeah exactly. A very different way of thinking. While there are exceptions always (friend table composed of user_id pairs), I view my database/schema as a namespace. So customer_id refers to the same entity across all my tables.
- euroderf 2y agoThis one is on the ground floor of my Dept of Pet Peeves.