Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009

    Unanswered: im confused, but not sure if im just being stupid - please help

    Really need some confirmation guys, I am new so apologies if this is obvious / silly question.

    I'm not sure if im missing something or just being silly, but i have 4 tables that i thought were linked, but now im not so sure.

    the four tables are:
    tblzonetypes, tblzones, tblstores2zones and tblstores.

    tblstores2zones links together stores and zones (fairly obvious i know) by fk's, fk_storeID and fkZoneID. ZoneTypes is linked to Zones.

    The four columns in tblstores2zones are: stores2zonesID, fk_storeID, fk_zoneID and active.

    However, when i put in a digit to ref zoneID in the fk_zoneID (in tblstoes1Zones), it is picking up the zonetypeID form the tblZoneType? Is this how it normally works?

    I thought it would pick up the fk_zoneID, as the column is named?

    any help would be great

    Thank all,

    kind regards

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    what does "pick up" mean?

    foreign keys don't "pick up" anything -- they simply ensure that the value that you enter is an existing value in the referenced primary/unique key

    by the way, the column stores2zonesID is totally redundant and useless -- the PK of tblstores2zones should be the composite key {fk_storeID, fk_zoneID} | @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