Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

16
  • 68
    If you do this, I hate you for making me do extra typing!!!! The table's name is Person, what do you think the Id is going to be? Car? no, it's Person. Commented Oct 17, 2011 at 18:19
  • 18
    @jim, I don't know about you, but typing 6 extra characters takes me roughly half a second. And considering I rarely ever select from one table, and thus would end up with two columns named 'Id' and will need to include the table/alias name anyhow, there is no savings in the number of characters typed. Commented Oct 17, 2011 at 19:13
  • 24
    @Chad I find it superfluous. if I'm doing a join, c.id = m.manufacturerid, is ok with me. These columns are typically "mapped" to a class somehow, and to have a class with Person.PersonId makes me want to vomit...Yes,I am fully aware I have issues. Commented Oct 17, 2011 at 19:26
  • 24
    I also disagree with this. Why stop at name and id? Why not have every column prefixed with its table name? It seems arbitrary to pick those two names to mandate a prefix. Conceptually, you must have the table in order to have the context of a column anyway. Why not just use that table name to clarify the query: Person.Name, Animal.Name, Part.Name,... Commented Oct 18, 2011 at 17:27
  • 12
    @Bill Leeper, DRY is not always appropriate in database development. In databases what is important is performance and making the database do extra work to fullfill DRY principles (such as using scalar functions or views that call views or queries that return too many columns or using a cursor to add 1000000 records to use an existing proc) is often contraindicated. Do not think that just because something is good in the Object-oriented world that it is appropriate in database design. Your downvote was inappropriate. Using ID is a known SQL antipattern. Commented Oct 20, 2011 at 21:38