
Ela/she/her. Director of Engineering @ Stack Overflow and https://xitter.cf/t.co/PdinbjMJPi cohost. 🏳️🌈 Alura Stars ⭐️ @rla4@hachyderm.io
- Tweets10.6K
- Following659
- Followers20.5K
- Likes25.2K

ALT All columns should be named with a prefix that is unique to the table they are defined in. E.g. Given tables "customer" and "address", let's go with prefixes of "cust" and "addr", respectively. "customer" would have "cust_id", "cust_name", etc. in it. "address" would have "addr_id", "addr_cust_id" (FK back to customer), "addr_street", etc. in it. When I was first presented with this standard, I was dead-set against it; I hated the idea. I couldn't stand the idea of all that extra typing and redundancy. Now I've had enough experience with it that I'd never go back. The result of doing this is that all of the columns in your database schema are unique. There is one major benefit to this, which trumps all arguments against it (in my opinion, of course): You can search your entire code base and reliably find every line of code that touches a particular column. The benefit from #1 is incredibly huge. I can deprecate a column and know exactly what files need to be updated before…

















