SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    create table with composite fk's?

    Hi, I am trying to create a table where two of the fields form a composite PK in the parent table.

    should the referring fk's be referred as a pair or individually.

    Code mysql:
    , CONSTRAINT rs_category_fk
       FOREIGN KEY (facility_category,facility_name)
         REFERENCES facilities_rooms_mainlist (facility_category,facility_name)
    It errors as it is now but I thought they should be 'paired'
    bazz

  2. #2
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    got it resolved. the primary key of the parent tbale had three values so I needed to realise that and then add the third one to the referencing constraint

    bazz


Bookmarks

Posting Permissions

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