Avatar of mdoland
mdoland
 asked on

General database theory

Many times an auto-generated number is used as the primary key. According to what I have learned, the best would be to have a primary key straight from the "true data" if it is possible. Comments on that?
Databases

Avatar of undefined
Last Comment
Dave Baldwin

8/22/2022 - Mon
SOLUTION
Kash

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
mdoland

ASKER
So an auto_incremented ID key has no good things about it?
Kash

auto incremented key can be a primary key as it is always going be +1 of the previous.
SOLUTION
Jose Torres

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Russell Fox

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Dave Baldwin

In MySQL, auto-increment primary key serves the purpose of a unique row id very well.  It should not be used for any other purpose though.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23