Forums Register Login

MySql primary keys

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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 ]
+Pie Number of slices to send: Send
thanks it worked (once I NOT NULL'ed the columns)
ms
There's a city wid manhunt for this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 844 times.
Similar Threads
Exception in Deleting Parent and Child entity
Hibernate: Found two representations of same collection
sequence generator with mysql
How to model a relation where a column has to refer two columns in different tables?
jdbc-sql
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 08:15:56.