List:General Discussion« Previous MessageNext Message »
From:Victor Subervi Date:May 20 2010 2:06pm
Subject:Re: Foreign Key Problem
View as plain text  
On Wed, May 19, 2010 at 12:02 PM, Shawn Green <shawn.l.green@stripped>wrote:

> Victor Subervi wrote:
>
>> On Wed, May 19, 2010 at 10:59 AM, Shawn Green <shawn.l.green@stripped
>> >wrote:
>>
>>  Shawn Green wrote:
>>
>>

> look again closely at your FK definitions. The pattern should be
>>>
>>
> FOREIGN KEY (child_table_column) REFERENCES
> parent_table(parent_table_column)
>
> Yours appears to be something else.


And indeed it was. This works:

create table if not exists Passengers (id int(11) auto_increment primary
key, flights_id int(11) not null, customer_id int(11) not null, foreign key
(id) references Flights (flights_id), foreign key (id) references Customers
(customer_id), name varchar(40), weight tinyint(3)) engine=InnoDB;

Yay! Thanks!
V

>
>
>
> --
> Shawn Green
> MySQL Principle Technical Support Engineer
> Oracle USA, Inc.
> Office: Blountville, TN
>

Thread
Foreign Key ProblemVictor Subervi18 May
  • Re: Foreign Key ProblemJohan De Meersman18 May
    • Re: Foreign Key ProblemVictor Subervi18 May
      • Re: Foreign Key ProblemJohan De Meersman18 May
        • Re: Foreign Key ProblemShawn Green18 May
          • Re: Foreign Key ProblemVictor Subervi18 May
            • Re: Foreign Key ProblemShawn Green18 May
              • Re: Foreign Key ProblemVictor Subervi19 May
                • Re: Foreign Key ProblemShawn Green19 May
                  • Re: Foreign Key ProblemVictor Subervi19 May
                    • Re: Foreign Key ProblemShawn Green19 May
                      • Re: Foreign Key ProblemVictor Subervi20 May
                        • Re: Foreign Key ProblemVictor Subervi22 May