Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2009

    referential integrity violation theory question?

    hey I'm learning databases @ uni and i'm a little confused abt referential integrity in this example:

    There are violations on referential integrity constrains

    Results (EventID, CompID, Pos, Time)

    Competitors (CompID, Country, CompName, NMedals, NEventsEntered)

    Records (EventID, Country, CompName)

    The above is all the slide says but I'm confused about what the violation is, is the referential integrity violation in this example that the non-primary key attributes Country and CompName in the Competitors relation reference the non-primary key attributes of Country and CompName in the Records relation?
    So does than mean whenever this happens (non-primary attribute of one relation referencing the non-primary attributes of another relation) that the referential integrity is violated?

    Btw, this may just be a typo in the slide but in the competitors table, the Key is a combination of CompId, Country and CompName. As you can see in the above copy of the slide Country and CompName weren't underlined.

    Last edited by Castiel; 04-10-10 at 01:57. Reason: Further clarification

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    not a lot to go on, is there

    i'm guessing a "record" is the best time for an event (or longest distance in the case of shot put etc.)

    so a record in an event is owned by a country and a competitor, and as such, the FK should be CompID

    i don't see this as a violation, though -- just an incorrect design | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jun 2004
    Arizona, USA
    you may also want to take a look at this RI (flash) training module. Quite useful...
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert

Posting Permissions

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