7

Screw this guy. Really.

(It's no foreign key, it's the actual id column.)

Comments
  • 6
    Besides non-english (I'd guess Spanish?), where is the problem?
    Not calling it "Id" but "UserId", allows consistent naming in all tables (if a n:m table between users and tickets exists, it can consist of "UserId" and "TicketId" as foreign keys, with every column having the same name as in their native tables.
    Naming them all "Id" may lead to inconsistent naming of foreign keys more often ("UserId", "id_user", "user_id", "other_id").
  • 0
    @sbiewald I concur, I have used both and always naming the id column id will cause problems.

    Especially when you later find that different other tables gave used different local names.
  • 5
    Or just use random column names
  • 0
    Have u ever tried to make sense of an explain with > 50 references...
    And aliases...
    And ID as the sole identifier name?

    It's painful. Very painful.
  • 0
    @sbiewald On foreign keys that's right, but on the main record id, it bothers me because I would have different names and sometimes not so obvious (here sie_x has Idx good, but what about tables with complex names?) that I have to take into account.
    When joining tables, it's redundant because you already have to specify the tables, and you have to write the name twice.
    By that reasoning, let's suffix every column name with the table's name, why not?
  • 0
    @c3r38r170
    Not fully right

    JOIN <Table>
    USING (id_table)

    Much cleaner and nicer.
  • 0
    @IntrusionCM And how would mxm tables' id column name look like? id_users_posts?
  • 1
    @c3r38r170

    Wtf....

    You don't seriously add an Auto Inc to an association table?
  • 0
    @zvyn
    Sorry, but that's more than "bad".

    There are serious performance implications... I don't know of a framework that does that...
  • 0
    @c3r38r170 Name your tables better?
    And yes, "users_post_id" would be a clear and consistent naming.
    And if abbreviations are, abbreviate the table names, but be consistent everywhere.
Add Comment