| Author |
MySql primary keys
|
Mike Southgate
Ranch Hand
Joined: Jul 18, 2003
Posts: 183
|
|
Now, I know this isn't quite JDBC but... I'm trying to create a table in MySql with 2 columns as the primary key. I tried this: create table workout ( userId varchar(32) primary key, workoutId mediumint primary key, workoutDate date, workoutType tinyint, creationDate date, lastUpdateDate timestamp, lastUpdateUserId varchar(32) ) type=InnoDB; but it didn't work... Any suggestions? ms
|
ms<br />SCJP, SCJD
|
 |
Simon Havenith
Greenhorn
Joined: Mar 01, 2004
Posts: 4
|
|
How about : create table workout ( userId varchar(32) , workoutId mediumint, workoutDate date, workoutType tinyint, creationDate date, lastUpdateDate timestamp, lastUpdateUserId varchar(32), PRIMARY KEY (userId,workoutId)) ; Cheers [ March 01, 2004: Message edited by: Simon Havenith ]
|
 |
Mike Southgate
Ranch Hand
Joined: Jul 18, 2003
Posts: 183
|
|
thanks it worked (once I NOT NULL'ed the columns) ms
|
 |
 |
|
|
subject: MySql primary keys
|
|
|