List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:October 10 1999 6:02pm
Subject:Re: oracle vs. Mysql
View as plain text  
On Sun, 1999-10-10 09:35:14 -0700, Yuval Malchi wrote:
> table user     table user_question   table Question
> user_id PK     user_id PK            question_id PK
>                question_id PK
> The PK in user_question is made up of both user_id and
> question_id. [...]  In Oracle I use the following syntax:
> constraint PK_USER_QUESTION primary key (USER_ID, QUESTION_ID)
> This doesn't seem to work for Mysql because it cannot create a table
> with multiple primary keys.

You most probably didn't look up the right syntax in the MySQL
Reference Manual, did you?

Please see chapters "7.6 CREATE TABLE syntax"
| A PRIMARY KEY can be a multiple-column index. However, you cannot
| create a multiple-column index using the PRIMARY KEY key attibute in
| a column specification.  Doing so will mark only that single column
| as primary. You must use the PRIMARY KEY(index_col_name, ...)
| syntax.

Martin Ramsch <m.ramsch@stripped> <URL: >
PGP KeyID=0xE8EF4F75 FiPr=5244 5EF3 B0B1 3826  E4EC 8058 7B31 3AD7
oracle vs. MysqlYuval Malchi10 Oct
  • Re: oracle vs. MysqlMartin Ramsch10 Oct