Gossamer Forum
Home : Products : Others : MySQLMan :

Multiple Primary Keys

Quote Reply
Multiple Primary Keys
A problem with MySQLMan.

I have a table called "Soccer_League", which contains serval fields such as Country_code, League_code, Team1, Team2 and Match_date. The table was created already by another script. MySQLMan displays the property of this table, there are 5 index keys like as bellow:

keyname --- Unique --- field name
Soccer_league_index1 --- NO --- country_code
Soccer_league_index1 --- NO --- league_code
Soccer_league_index1 --- NO --- match_date
Soccer_league_index1 --- NO --- team1
Soccer_league_index1 --- NO --- team2

The problem is, when I browse this table, there is no edit/delete action for any records. So I want to set some unique keyname for fields. How can I set keynames like:

keyname --- Unique --- field name
Soccer_league_index1 --- YES --- country_code
Soccer_league_index1 --- YES --- league_code
Soccer_league_index1 --- YES --- match_date
Soccer_league_index1 --- YES --- team1
Soccer_league_index1 --- YES --- team2

or

keyname --- Unique --- field name
PRI --- YES --- country_code
PRI --- YES --- league_code
PRI --- YES --- match_date
PRI --- YES --- team1
PRI --- YES --- team2

MySQlMan doesn't allow me to do that ... but actually I saw some tables had this kind of keynames. What should I do?

Sorry for my English.
Thanks a lot.


Quote Reply
Re: Multiple Primary Keys In reply to
Hi, I found a sloution by myself:)

From SQL monitor, run:

CREATE UNIQUE INDEX soccer_league_index_1 ON soccer_league (country_code, league_code, team1, team2, match_date)

then I got multiple primary key, and I can edit/delete records now. But is there any easy way to do that with MySQlMan?


Quote Reply
Re: Multiple Primary Keys In reply to
Multiple primary keys can be set easily when you create a new table. However, after a table is created, there is really no "easy" way to set mutiple primary keys other than the way you pointed out.

--
Gossamer Threads, Inc.