Hi,

Asaf Maruf wrote:
> 
> How can i specify two columns together as primary key for a table.
> 
> Using create table test
> (increment int , id int not null primary key, date not null primary key, name 
>char(20) );
> 
> doesn't work.

You should rather say

create table test (
  increment int , 
  id int not null, 
  X date not null,
  primary key ( id, X ),
  name char(20) 
);

You didn't supply a column name for your date column,
so I resorted to an ever-green X.

> Is it possible that one column is text and other is integer?

Yes. Well, not exactly TEXT as the MySQL data type, 
but it can be a string (i.e., CHAR or VARCHAR) of reasonable length.


Multiple-column primary keys are mostly used 
in tables that are details of other tables.
(Read: have foreign keys to other tables.)


Jan

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to