Lately I've been thinking about what's a better name for foreign keys, either user_id
, or id_user
style.
Personally I think id_user
style is better for handling within database (db queries) where it's clear from the first three characters that the column is containing ID.
On the other hand I find user_id
style more suitable e.g. with use of HTML autocomplete fields where there are two input fields; one name="user"
for text, the other name="user_id"
for his ID; which makes it easier to recognize that they belong to each other because they both start their name by defining what the content will be about.
What do you think?
Best Answer
I prefer user_id but I think it doesn't really matter as long as you stay consistent and not mix them up so you keep your overview structured and readable.