No.
But u may use two or more "super key" instade. or can create a primary key using two or more fields (combined)
2006-09-05 20:30:58
·
answer #1
·
answered by dsubha454 2
·
0⤊
0⤋
No u cant set 2 primary keys in a table ,but set it as candidate key.
U can set 2 fields together to be unique ,by setting the unique index on them together. And ofcourse not null on each individually!
2006-09-05 20:32:37
·
answer #2
·
answered by Princess 2
·
0⤊
0⤋
short answer NO.
You also may only have one autonumber key.
You may want to use an auotnumber key for tracking purposes then cluster another key.
clustering the key will arrange it on the disk in that order. This is generally where you can pick up some speed.
2006-09-05 20:35:00
·
answer #3
·
answered by joe f 3
·
0⤊
0⤋
You didn't mention what brand of sql - MySQL? MSSQL? Mostly you just use one primary key and then use unique indexed columns. Read the thread in the link below it should point you in the right direction.
2006-09-05 20:32:52
·
answer #4
·
answered by teef_au 6
·
0⤊
0⤋
yes it is possible.......u can do it by making a grp of keys ur primary key..this is called composite key
2006-09-05 22:02:35
·
answer #5
·
answered by vivek s 1
·
0⤊
0⤋
its not possible, we can set up only composite primary key.
2006-09-05 20:31:26
·
answer #6
·
answered by RedFerrari 4
·
0⤊
0⤋
Yes. This will set grp and id to primary keys.
CREATE TABLE animals (
grp ENUM('fish','mammal','bird') NOT NULL,
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (grp,id)
);
2006-09-05 20:30:57
·
answer #7
·
answered by Richard M 2
·
0⤊
0⤋