Home > Archive > PHP DB > March 2007 > MySQL Foreign Key Issue
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
MySQL Foreign Key Issue
|
|
| Lasitha Alawatta 2007-03-26, 3:58 am |
| Hello,
I have 2 issue, regarding MySQL "Foreign Key".
I have two tables;
Table 01 CUSTOMER
column name
characteristic
SID
Primary Key
Full_Name
Table ORDERS
column name
characteristic
Order_ID
Primary Key
Order_Date
Customer_SID
Foreign Key
Amount
When I run "ALTER TABLE ORDERS ADD FOREIGN KEY (customer_sid) REFERENCES
CUSTOMER(SID);" that sql statement,
I inserted 2 records to both tables.
Question No. 01.
Then I removed 1 record from CUSTOMER table. But It want give any error
message. It should give an error message, because in ORDERS table
already have some records relevant to the deletedcustomer record in
CUSTOMER table.
Questionis why it want give any error ? (I'm using phpMyAdmin)
Question No. 02.
Is there any tool available for to geta Database diagram (like in MS
SQL Server). I found a tool call "DBDesigner 4". But it wants show the
DB Diagram.
Thanks in Advance,
Lasitha.
DOTW DISCLAIMER:
This e-mail and any attachments are strictly confidential and intended for the addressee only. If you are not the named addressee you must not disclose, copy or take
any action in reliance of this transmission and you should notify us as soon as possible. If you have received it in error, please contact the message sender immediately.
This e-mail and any attachments are believed to be free from viruses but it is your responsibility to carry out all necessary virus checks and DOTW accepts no liability
in connection therewith.
This e-mail and all other electronic (including voice) communications from the sender's company are for informational purposes only. No such communication is intended
by the sender to constitute either an electronic record or an electronic signature or to constitute any agreement by the sender to conduct a transaction by electronic means.
| |
| Roberto Mansfield 2007-03-26, 6:57 pm |
| Are you using InnoDB for you tables?
Lasitha Alawatta wrote:
> Hello,
>
>
>
> I have 2 issue, regarding MySQL “Foreign Key”.
>
> I have two tables;
>
> Table 01 */CUSTOMER/*
>
> column name
>
>
>
> characteristic
>
> SID
>
>
>
> Primary Key
>
> Full_Name
>
>
>
>
>
>
>
> Table */ORDERS/*
>
> column name
>
>
>
> characteristic
>
> Order_ID
>
>
>
> Primary Key
>
> Order_Date
>
>
>
>
>
> Customer_SID
>
>
>
> Foreign Key
>
> Amount
>
>
>
>
>
>
>
> When I run “ALTER TABLE ORDERS ADD FOREIGN KEY (customer_sid) REFERENCES
> CUSTOMER(SID);” that sql statement,
>
>
>
> I inserted 2 records to both tables.
>
> _ _
>
> _Question No. 01._
>
> Then I removed 1 record from CUSTOMER table. But It want give any error
> message. It should give an error message, because in ORDERS table
> already have some records relevant to the deleted customer record in
> CUSTOMER table.
>
>
>
> Question is why it want give any error ? (I’m using phpMyAdmin)
>
>
>
> _Question No. 02._
>
> Is there any tool available for to get a Database diagram (like in MS
> SQL Server). I found a tool call “DBDesigner 4”. But it wants show the
> DB Diagram.
>
>
>
>
>
> Thanks in Advance,
>
> Lasitha.
>
>
>
>
>
>
>
>
> DOTW DISCLAIMER:
>
> This e-mail and any attachments are strictly confidential and intended for the addressee only. If you are not the named addressee you must not disclose, copy or take
> any action in reliance of this transmission and you should notify us as soon as possible. If you have received it in error, please contact the message sender immediately.
> This e-mail and any attachments are believed to be free from viruses but it is your responsibility to carry out all necessary virus checks and DOTW accepts no liability
> in connection therewith.
>
> This e-mail and all other electronic (including voice) communications from the sender's company are for informational purposes only. No such communication is intended
> by the sender to constitute either an electronic record or an electronic signature or to constitute any agreement by the sender to conduct a transaction by electronic means.
>
|
|
|
|
|