What table relationship?

dmogie

Registered User.
Local time
Today, 23:13
Joined
Feb 14, 2008
Messages
10
Hi, I have these two tables

horse_entries
ent_HorseName (PK)
ent_entries

horse_information
inf_HorseName
inf_Ground
inf_Notes

I have no records in horse_information yet. I need it so that when a record is added to the first table then whatever is added to ent_HorseName is added to inf_HorseName. So I want all the records from horse_entries in horse_information. I want to be able to add to horse_information without that record being added to horse_entries. What kind of relationship should I use. Thanks
 
i dont quite see where you are going

what does horse_entries deal with and what does horse_information deal with
 
i dont quite see where you are going

what does horse_entries deal with and what does horse_information deal with

Hi, horse_entries table will have
ent_HorseName (PK) (horse name)
ent_entries (races horse is entered for, for example my dad uses T8 one race that's coming up)

horse_information will have
inf_HorseName (horse name)
inf_Ground (info on horse ground preference if there is one)
inf_Notes (notes my dad writes about horse if there is any)

I want a record created in horse_information every time I add one to horse_entries. So if I add a record to the horse_entries table like

ent_HorseName
Code:
Mourne Rambler
ent_entries
Code:
T8
then I want
Code:
Mourne Rambler
added to inf_HorseName. inf_Ground and inf_Notes left blank. Horses I add directly to horse_information I don't want added to horse_entries.

I was using a one-to-one relationship before and had checked enforce referential integrity. The problem was when I added a horse to the horse_entries table it wasn't added to the horse_information table. When I add a horse to the horse_information table then it would say 'You cannot add or change a record because a related record is required in table horse_entries'
 
i thought so

your relationship is the other way round

the main table is the horse-information table

the linked table is the horse-entries table

ie 1 horse-information can have several horse-entries,

----------
so if you get a new horse you need it to add to the horse-information table FIRST

now rather than use horsename in both tables, you should have a field called horsenumber in the horse_information file, and store this in the horse_entries table. This field should be the primarykey in the horseinfo table.

your link in the relationship diagram should be from the horsenumber in the horseinfo to the horsenumber in the horseentries table

with regard to the horseentries table, what is the ent-entries supposed to represent. you have to be careful as the race indentifier should presumably include track/date/racenumber maybe. In your example what does T8 represent
 

Users who are viewing this thread

Back
Top Bottom