Is it right to identify the columns in the database tables?

Asked

Viewed 37 times

0

I have a question: In large projects, which require a lot of relationship between the tables, many Joins, identify each column with the table, for example:

Instead of:

Table name: users

id | name | email

Thus:

user_id | user_name | user_email

Since they will have other tables with the same type of data, such as name, email and mainly ID. Do you have a problem not identifying? Disturbs Joins? How big companies with Facebook do?

  • 1

    Take a look at this topic that I created a little while ago, the answers were amazing in themselves. Table and column nomenclature

  • Wow, hadn’t seen it, it’s really quite good. What do I do now? I remove that question?

  • I’ve read everything, but I was wondering if you have a problem with conflict using several Joins, which was not explained there.

  • That was just one of the points I raised but explained little there. An example, I have the user table with the field id and the table acesso with the same field id, if in my select I didn’t say the field id user become usuario_id, then it will return a single column id(which may be of the user or access) and there is a small problem. In that case, to avoid possible conflicts I take care of that which I quoted above and use very well the alias, as a solution.

  • Always use aliases then? But if I have many fields, as I said, a large project, with several columns with the same name, the alias would be a good solution? Wouldn’t it be gambiarroso?

  • Wow, you’re my soul mate, I’ve thought of everything you’re questioning. But then, I think feature was invented to be used, if not used has no sense. Shoot alias as much as inner join, are resources, so there to be used.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.