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.

Required fields*

4
  • 5
    In spite of its name id is not primary key. So, even though you are not counting you still need to find all matching records, possibly thousands of them. About aliasing - code is constant work in progress. You never know when you'll have to go back. Aliasing helps preventing stupid runtime errors; for example, unique column name that didn't need an alias is not unique any more because somebody created a column of same name in another, joined table. Commented Aug 7, 2013 at 22:21
  • Yes, you are absolutely right. Aliasing helps a lot but i don't think it makes any difference when not using joins. So, I said don't use it if not necessary. :) And you can find a long discussion here on checking existence. :) Commented Aug 7, 2013 at 22:34
  • 3
    I don't know why I acccepted the term aliasing. Correct term is qualifying. Here is longer explanation by Alex Kuznetzov. About single table queries - it is single table now. But later, when bug is discovered and you are trying to hold the flood, client is nervous, you join another table just to face error message - easily correctable message, but not at this sweaty moment, a small stroke strikes - and you correct the error remembering never to leave a column ... Commented Aug 7, 2013 at 22:47
  • 1
    Can't ignore that now. Thanks!! :) Commented Aug 7, 2013 at 23:10