At 10:25 -0800 2/10/04, Seena Blace wrote:
Hi,
I want to create a table with composite Primary key.How to do that?
create table ipdet
(IPaddress varchar (14) not null ,
hostid varchar (20) not null primary key (ipaddress,hostid),
IP_DESC text ,
MAC text,
interface text);
thx-seena
You're trying to do it by adding the PRIMARY KEY clause at the end
of a column definition. When you do that, it will apply only
to that column. (In other words, that syntax works only for
creating a single-column PRIMARY KEY.)
To indicate that you want to include multiple columns in the index,
you must use a separate PRIMARY KEY clause. For the statement
shown above, you can achieve that simply by putting a comma before
the word "primary".
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
MySQL Users Conference: April 14-16, 2004
http://www.mysql.com/uc2004/
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]