Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2011
    Posts
    5

    Unanswered: Primary Key Issue need help

    Table Emp

    empno (pk)
    fname
    lname
    hiredate

    Table dept

    deptid (pk)
    deptname

    Table Emp_dept

    empno (fk)
    deptid (fk)
    fromdate
    todate


    Above is the scenario which is confusing me and i need help. As you can see the Emp_dept table has both the empno and deptid as foreign key.

    I am confused that wheather a primary key to be established for this table or is it ok as is?

    Would someone help plz.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    yes, the PK for that table would be the first three columns

    the PK would not prevent logical inconsistencies, but it's better than no PK at all
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •