Forcing a row to be related to at least another row

  • Hallo

    I need to implement this:

    A row in table A must be in relationship with at least one row in table B.

    Could this be achieved by constraints only?

    Thanks in advance

  • This sounds like a homework question. What you want is Foreign Keys and Relational Integrity. Use those as your keywords for google and you'll find what you're looking for.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Hallo Craig.

    It's not so easy, thank you anyway.

  • lordzoster (6/7/2013)


    Hallo Craig.

    It's not so easy, thank you anyway.

    Why do you think it is not so easy? Applying referential integrity is not so difficult either.

    Can you explain us the situation in a bit more detail?

    We like to solve challenging questions.


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply