Jump to content

are these primary keys okay?


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

Recommended Posts

Hello

I'm new and I'm struggling with the concept of primary keys.

I've got four files for a farm.

Planting details which times the planting of crops, and works out how many seeds are needed to be planted based on a grower's order. (Has variety, grower's name, planting date, picking date)

Plant growth which just has the different growth rates of a variety given the time of year planted. (Has variety, january, february...december)

Seed bank which maintains a running balance of different varietal seeds in stock. (has variety, date in, date out, then calculation fields)

Growers which is a contact database of clients. (growers name, address, telephone)

The first three files all have defined relationships based on variety. The contact database I'll link to Planting details with Grower name so I can work out who the seeds are getting grown for.

I haven't set up any specific auto-entry fields as primary keys but notice that filemaker has indexed the variety field automatically in the first three files (I suppose based on the relationship). Is this fine?

Is there a specific reason for setting up an automatic numbering system for each record in a file?

I'm wanting to work this out now so that I have no nasty surprises later on when the fields are populated with data.

Thanks everyone

Drew

PS. I suppose indexing the contact file with an automatic number would help with that file in case two grower's had the same name. Is this correct?

Link to comment
Share on other sites

It's generally considered asking for trouble to use names of any kind as primary keys. Like you said, "...in case two growers had the same name." shocked.gif Yikes! Also, what if a person or plant's name needs to change? A big mess if you're relying on that as a key field. Much safer to go with some sort of number or alphanumeric code that is used ONLY for database housekeeping.

Link to comment
Share on other sites

This topic is 8145 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.