Hi.. i have two ways for make something and don't know what's better ......
Problem : 3 tables
Client ----> ( 1,* ) Activity -----> (1,1) ActivityAccreditation
A Client it can have one or more activities, and one Activity have one ActivityAccreditation. On Client the primary key is CLIENT_ID, the two ways for generate the keys on the other tables are :
a ) On Activity the primary key is composed by CLIENT_ID and SEQUENCE_ACTIVITY ( a number than increment value by CLIENT_ID, example : CLIENT_ID = 1122 could have SEQUENCE_ACTIVITY from 1 to 3 for three activities, and CLIENT_ID = 1122 could have SEQUENCE_ACTIVITY from 1 to 4 for four activities ), and ActivityAccreditation have CLIENT_ID and SEQUENCE_ACTIVITY and ACCREDITATION_TYPE ( a code ).
b) On Activity the primary key is ACTIVITY_ID ( auto increment number ) with the CLIENT_ID like foreign key only. And on ActivityAccreditation have ACTIVITY_ACCREDITATION_ID like primary key and ACTIVITY_ID like foreign key.
The situation is than the numer of rows could to grow very much in the time ( 3.000.000 rows on ActivityAccreditation in one year and the database to be supported each five years ) and we don't know what solution is better by performance......
Tks.
|