Foreign Key in Mysql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • santhanalakshmi
    New Member
    • May 2009
    • 147

    Foreign Key in Mysql

    Hi,

    i have empty rows in my table.While trying inserting my records.It shows me the following errors:


    ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint f
    ails (`test`.`stuprm st`, CONSTRAINT `stuprmst_ibfk_ 1` FOREIGN KEY (`rollno`) REFERENCES `stuprmst` (`rollno`))
  • Dheeraj Joshi
    Recognized Expert Top Contributor
    • Jul 2009
    • 1129

    #2
    is roll number a foreign key? In that case you must add the roll number in the parent table then try to add it in child table.

    Regards
    Dheeraj Joshi

    Comment

    • santhanalakshmi
      New Member
      • May 2009
      • 147

      #3
      foreign key constraint

      i have all my records in the parent table.But why i cant able to insert the same primary key value in the foreign key table...



      thanks

      Comment

      Working...