• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MySql primary keys

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks it worked (once I NOT NULL'ed the columns)
ms
 
reply
    Bookmark Topic Watch Topic
  • New Topic