Jump to content
Server Maintenance This Week. ×

Very basic question


This topic is 6890 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I was watching a video at Petrowsky's site and he said that every table should have as it's first field, a number field labled ID, auto enter serial number. My question is: is this necessary in child records? What is the purpose of doing this?

Toffler

Link to comment
Share on other sites

As the sign in a nearby cemetery says, "Better to have and not need, than to need and not have."

I would not say that it needs to be a number field, I prefer text.

Every table should have a primary key.

Link to comment
Share on other sites

This is usually true, but I think saying "every table" is too much of a generalization. Join tables don't necessarily need a primary ID. "Value list" tables may not need them. The reason why you should not put them in tables where they are not needed is because of imports. It sometimes happens that you have to import existing records into a new version, etc.. In that case you only want to have to reset serial IDs where necessary, the less the better.

I know Ralph is into separation of data (which is something I need to learn more about), so he wouldn't have this problem so often. I would say "almost every table." Whether a child table needs one or not depends on whether you're going to be processing each one of the child records at some point. Usually you are, so you need an auto-enter serial ID to be able to positively identify a particular child record.

Schemes you commonly see in businesses, using numbering calculations, the "next" job number, etc., have their use (mostly to keep the client happy :-), but are not as reliable.

Link to comment
Share on other sites

This topic is 6890 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.