You can have two or more fields inside a primary key, but this is inefficent when indexing the table as both fields will have to be included in an index. Alternatly you can make another field a Unique Key. It works similarly to the primary key in that it is indexed and it doesn't allow duplicate values in the column. The main difference however is that queries on the Unique column will be one degree slower than queries on the primary key, but this is usually not noticable.
2006-07-16 08:47:01
·
answer #1
·
answered by John J 6
·
1⤊
0⤋
You can have a composite key, which means that you can designate two or more fields to collectively make up the primary key. So basically, what would happen is the database wouldn't allow any two entries which contain all identical information in all of those fields.
For example, you could use name, street address and phone number in a table. Then, you could add entries with the same phone number and street address as long as the name was different, etc.
2006-07-16 07:36:06
·
answer #2
·
answered by I Know Nuttin 5
·
0⤊
0⤋
Now that would go against the definition of a primary key, now wouldn't it. But you can have a "composite key" which is composed of more than one field, and you can have foreign keys which can be one or more fields.
2006-07-16 07:56:15
·
answer #3
·
answered by Anonymous
·
0⤊
0⤋
no but there can be a combination of 2 unique constraints that sort of represent one primary key. so what i mean is 2 columns can be like one primary key
2006-07-16 07:35:34
·
answer #4
·
answered by dtstuff9 6
·
0⤊
0⤋
No... Any database table can only have one primary key.
2006-07-16 07:33:27
·
answer #5
·
answered by prosperous_lunatic 3
·
0⤊
0⤋
u can use foreign key to make multiple primary keys
2006-07-16 23:41:49
·
answer #6
·
answered by Anonymous
·
0⤊
0⤋