LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   MySQL and MyPHPAdmin (http://www.linuxquestions.org/questions/programming-9/mysql-and-myphpadmin-533157/)

Neko_D 02-28-2007 12:21 AM

MySQL and MyPHPAdmin
 
So this is a general MySql question. In the database I am building I have serial numbers. Problem is these numbers are only unique within their individual category. So basically the serial number 2007-01 could be used in several different categories. So I am making the four columns that defines these categories into primary keys. Now I want use these categories as forigen keys. I am not sure how to declare multiple forgien keys. Could someone show me how to do this.

Also if someone is familiar with the program MyPHPAdmin. Could you tell me how to make forgien keys using the program?

Thanks for any help.

baikonur 02-28-2007 02:15 AM

what do you mean by 'category'?
what is a forgien key? do you mean foreign?
about how many tables are we talking here? just one?

advice: get familiar with the terminology. be exact! no programmer will take you serious when you don't even bother to spell the name of phpmyadmin correctly.
and...
DESCRIBE YOUR PROBLEM WELL!! make some effort. if you feel this is stupid, get away from programming.

lorebett 03-01-2007 02:39 AM

Quote:

Originally Posted by Neko_D
Now I want use these categories as forigen keys. I am not sure how to declare multiple forgien keys. Could someone show me how to do this.

In order to use foreign keys you need your tables to be of type InnoDB.

When tables are InnoDB tables phpmyadmin also shows a menu to create relations.

jlinkels 03-01-2007 05:15 AM

Well, it is still not clear what the OP means with 'categories' and apparently his problem is not so urgent that he cares to explain it to us. I assume that he means 'tables' though.

Now I am not really a MySQL crack, but I thought foreign key were needed to ensure referential integrety. That is, (among other things) you cannot delete a record from one table which is used (referred to) in another table.

It doesn't help for entries which are non-unique across tables. What is the problem with that anyway?

jlinkels

Neko_D 03-01-2007 02:41 PM

Quote:

Originally Posted by lorebett
In order to use foreign keys you need your tables to be of type InnoDB.

When tables are InnoDB tables phpmyadmin also shows a menu to create relations.

Thanks that is what I needed to know.


All times are GMT -5. The time now is 07:39 AM.