• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MySql primary keys

 
Mike Southgate
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Simon Havenith
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks it worked (once I NOT NULL'ed the columns)
ms
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic