Defining Primary Key from two fields (1 Viewer)

dbmanalser84

Registered User.
Local time
Today, 11:28
Joined
Feb 26, 2008
Messages
52
I have this table:

intSalesID (Number, Indexed: (Yes No Duplicates)
intCarID (Number, Indexed: (Yes No Duplicates)
intQuantitySales (Number, Indexed: (No)

This table is a cross table from the two tables tblCars and tblSales where the intSalesID and intCarID are Primary Keys. In this table I didn't set the P.K. I saw databases that have P.K. in tables like this deined from the two fields (intSalesID and intCarID, would be in my case). I wanted to ask what is the difference if I leave this table like this and if I set this two fields to form a P.K.? What is the difference in these twi cases? What do I get and what I don't, if I do either way? Thnx.
 
if the data in table gets populated by only cross product from the other two tables where intsalesID and intcarid are column then it should not affect the population of third table if we do not have PK defined. But if we have PK defined then probably the search will be faster on the table as it will be indexes.
I dont see any harm if you define the two columns as composite PK on the table
Ashish
 
PH to the rescue again!
 

Users who are viewing this thread

Back
Top Bottom