Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Foreign keys

  • This topic is empty.
Viewing 0 reply threads
  • Author
    Posts
    • #7660
      dany
      Member

      I cannot create foreign keys on InnoDB tables (Windows 2000/MySQL 4.0.9).

      I'm trying to create a foreign key between Owners.IDcar and Car.ID but i think that Webyog 3.01 understands that I'm trying to do something different (in the SQL statement it writes IDcar two times).

      Here are the SQL statements:

      First table

      Code:
      create table `test`.`Cars` (
       `ID` bigint   NOT NULL ,
      `name` char (20)   NOT NULL  ,
      PRIMARY KEY ( `ID` )
      )type=InnoDB row_format=dynamic

      Second table

      Code:
      create table `test`.`Owners` (
       `ID` bigint   NOT NULL ,
      `name` char (15)   NOT NULL ,
      `IDcar` bigint   NULL  ,
      PRIMARY KEY ( `ID` )
      )type=InnoDB row_format=dynamic

      Indexes

      Code:
      alter table `test`.`owners` add index `indexIDcar` ( IDcar )
      alter table `test`.`owners` add foreign key (IDcar) references `cars` (IDcar) on delete restrict

      Thanks

Viewing 0 reply threads
  • You must be logged in to reply to this topic.