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?
Take a look at this topic that I created a little while ago, the answers were amazing in themselves. Table and column nomenclature
– William Novak
Wow, hadn’t seen it, it’s really quite good. What do I do now? I remove that question?
– Artur
I’ve read everything, but I was wondering if you have a problem with conflict using several Joins, which was not explained there.
– Artur
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 tableacesso
with the same fieldid
, if in myselect
I didn’t say the fieldid
user becomeusuario_id
, then it will return a single columnid
(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 thealias
, as a solution.– William Novak
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?
– Artur
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 asinner join
, are resources, so there to be used.– William Novak