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!
--
What they need to teach in school is for people to think for themselves
-
From: sherzodR [EMAIL PROTECTED]
To: Demirchyan Oganes-AOD098 [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, 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
06, 2001 1:54 PM
To: '[EMAIL PROTECTED]'
Subject: Creating MySQL table w/2 primary keys
Hello everyone,
I have this create table statement,
drop table IF EXISTS GROUP_CONCLUSION_GROUPING CASCADE;
CREATE TABLE IF NOT EXISTS GROUP_CONCLUSION_GROUPING(
ANALYSIS_RESULT_ID MEDIUMINT(20) PRIMARY
Hello everyone,
I have this create table statement,
drop table IF EXISTS GROUP_CONCLUSION_GROUPING CASCADE;
CREATE TABLE IF NOT EXISTS GROUP_CONCLUSION_GROUPING(
ANALYSIS_RESULT_ID MEDIUMINT(20) PRIMARY KEY REFERENCES
PAD_ANALYSIS_RESULT(ANALYSIS_RESULT_ID),
GROUP_CONCLUSION_ID
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]
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
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, and
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
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;
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
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,
- col2 int not null
11 matches
Mail list logo