DEV Community

Discussion on: How to name software things, be a good programmer & work solo

Collapse
 
zeslova profile image
Simon Newby • Edited

I'm feeling bad about the database I tossed up last week where all the ID columns are called ID rather than <tablenameID now... 😳

Collapse
 
buinauskas profile image
Evaldas Buinauskas • Edited

This isn't generally bad. I worked with both and having TableNameID makes a lot of sense when you write more SQL code. It makes join conditions way easier to read.

Collapse
 
zeslova profile image
Simon Newby

Yeah definitely, and since I'm using the ids to correspond to other numeric columns in one base table then using a view to display strings instead of underlying integers, I think it's passable for the time being.

Collapse
 
danyalasif profile image
Daniyal

It seems pretty okay for a database since the context gives it meaning and using 'id' is pretty common in database lands. i.e. don't feel bad!

Collapse
 
mohanarpit profile image
Arpit Mohan

I actually prefer that instead of tablenameID. I typically don't like alliteration in my SQL queries or code function calls. I'd much rather invoke select * from users where id = ? instead of select * from users where userid=?

I find the first one more readable and understandable as well.