Jump to content
Larry Ullman's Book Forums

imsachinraut

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by imsachinraut

  1. Hello group,

     

    I have query in "orders" table. Here "id" is "primary key" & in foreign key CONSTRAINT the same "id" has been made "foreign key"

     

    CONSTRAINT `fk_orders_user1` FOREIGN KEY(`id`)

    REFERENCES `users`(`id`)

     

     

    I feel its a typo, but the query executes smoothly & doesn't produce any error .

     

    In 'orders' table if the 'users_id' is foreign key then the FK constraint clause should have been as follows.

     

    CONSTRAINT `fk_orders_user1` FOREIGN KEY(`users_id`)

    REFERENCES `users`(`id`) 

     

     

    Am i right?

     

    regards

    Sachin Raut

     

     

  2. hi all,

     

    I am a newbie to database designing & web programming.

     

    In 'orders' table, the FK constraint clause is as follows.

     

    CONSTRAINT `fk_orders_user1` FOREIGN KEY(`id`)

    REFERENCES `users`(`id`)

     

    Is it a typo? Because in 'orders' table if the 'users_id' is foreign key then the FK constraint clause should have been as follows.

     

    CONSTRAINT `fk_orders_user1` FOREIGN KEY(`users_id`)

    REFERENCES `users`(`id`) 

     

    Am i right folks?

     

    regards

    Sachin Raut

×
×
  • Create New...