RE: Creating MySQL table w/2 primary keys

2001-12-07 Thread Edward Valentine
What is your goal here? Is this a file linking two other files, the group_conclusion file and the Pad_analysis_result file? Or something like that? Where you search for all of the records with a single group_conclusion and then reference the analysis_result records? My first question is are these

Re: Creating MySQL table w/2 primary keys

2001-12-07 Thread Etienne Marcotte
Clausen [EMAIL PROTECTED] > > - Original Message - > From: "sherzodR" <[EMAIL PROTECTED]> > To: "Demirchyan Oganes-AOD098" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Thursday, December 06, 2001 11:58 > Subject: Re: Creatin

Re: Creating MySQL table w/2 primary keys

2001-12-07 Thread A. Clausen
y, December 06, 2001 11:58 Subject: Re: Creating MySQL table w/2 primary keys > > As far as I know, you can't do tht. What you could do instead is > have one Primary Key col and make another one UNIQUE. > > I did that several times, and it does work! > > -- > > W

RE: Creating MySQL table w/2 primary keys

2001-12-06 Thread Quentin Bennett
December 2001 9:42 a.m. To: sherzodR Cc: Demirchyan Oganes-AOD098; '[EMAIL PROTECTED]' Subject: Re: Creating MySQL table w/2 primary keys I found a way to have two primary key, if those keys relate on many columns. mysql> create table keytest( -> col1 int not null, ->

Re: Creating MySQL table w/2 primary keys (fwd)

2001-12-06 Thread rc
for a table in a database (just so my message makes it to the list): can you make a concatenated primary key, then make the second one an index? - Before posting, please check: http://www.mysql.com/manual.php (the man

Re: Creating MySQL table w/2 primary keys

2001-12-06 Thread Etienne Marcotte
I found a way to have two primary key, if those keys relate on many columns. mysql> create table keytest( -> col1 int not null, -> col2 int not null, -> unique index (id1,id2), -> unique index (id2,id1) Query OK, 0 rows affected (0.01 sec) mysql> describe keytest; +---+--

Re: Creating MySQL table w/2 primary keys

2001-12-06 Thread Etienne Marcotte
using primary key (col1, col2) makes no index on col2... which is not good if you lookup only in col2 primary key (col1), unique index (col2) don't forget to add "not null" beside your col2 definition. Etienne rc wrote: > > why not use a concatenated Primary key? > > create table tname > c

Re: Re: Creating MySQL table w/2 primary keys

2001-12-06 Thread rc
On 6 Dec 2001 [EMAIL PROTECTED] wrote: > Your message cannot be posted because it appears to be either spam or > simply off topic to our filter. To bypass the filter you must include > one of the following words in your message: > > database,sql,query,table > > If you just reply to this message

Re: Creating MySQL table w/2 primary keys

2001-12-06 Thread rc
why not use a concatenated Primary key? create table tname col_name1 int, col_name2 int, PRIMARY KEY (col_name1,col_name2) you get the drift On Thu, 6 Dec 2001, sherzodR wrote: > > As far as I know, you can't do tht. What you could do instead is > have one Primary Key col and make

Re: Creating MySQL table w/2 primary keys

2001-12-06 Thread sherzodR
As far as I know, you can't do tht. What you could do instead is have one Primary Key col and make another one UNIQUE. I did that several times, and it does work! -- What they need to teach in school is for people to think for themselves. :-) -- Larry Wall in <[EMAIL PROTECTED]>