MySQL Forums
Forum List  »  Newbie

Re: manually add foreign key
Posted by: Phillip Ward
Date: September 20, 2022 08:32AM

Both fields must be the same Data Type.

mysql> desc cust_table;
. . . 
| cust_id | int | NO | PRI | NULL | auto_increment |
. . . 

mysql> desc sales_table;
. . . 
| cust_id | varchar(45) | YES | | NULL | |
. . .

Changes sales_tables to use an int cust_id instead.

Regards, Phill W.

Options: ReplyQuote


Subject
Written By
Posted
September 20, 2022 04:07AM
Re: manually add foreign key
September 20, 2022 08:32AM
September 20, 2022 11:07PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.