Knute Snortum wrote:I've read a few articles saying that AUTOINCREMENT should be avoided, but it's what I use, and I'm not sure how to do the same thing without it.
I think that in some versions of some databases, autoincrement is not a language feature. And in some cases, there are different types of auto-generated fields possible, not just auto-incremented integers. And different means have been used (such as Oracle's DUAL table) to create them. How much of this is now normalized and portable across platforms and versions, I don't know - haven't looked recently. But it's stuff like that that has made it difficult to use autoincrement.
On the other hand, as far as I'm concerned, if your platform support it, I recommend taking advantage of it.
Now there
have been platforms and projects where I couldn't assign a unique primary key value until fairly late in the process and had to do it manually. And some platforms where the key would be generated but it was difficult or impossible to tell what the generated key value actually was. But if you don't have those problems, go for it!
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.