Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6813419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:34:05+00:00 2026-05-26T20:34:05+00:00

Given four tables: CREATE TABLE LIST_A ( A INT, PRIMARY KEY (A) ) CREATE

  • 0

Given four tables:

CREATE TABLE LIST_A (
    A INT,
    PRIMARY KEY (A)
)

CREATE TABLE LIST_B (
    A INT,
    B INT,
    PRIMARY KEY (A, B),
    FOREIGN KEY (A) REFERENCES LIST_A (A)
)

CREATE TABLE LIST_C (
    C INT,
    A INT,
    PRIMARY KEY (C),
    FOREIGN KEY (A) REFERENCES LIST_A (A)
)

CREATE TABLE LIST_D (
    C INT,
    D INT,
    B INT,
    PRIMARY KEY (C, D),
    FOREIGN KEY (C) REFERENCES LIST_C (C)
)

I want to add another constraint: Given a row in LIST_D, whose primary is (C0,D0), and its parent row in LIST_C, whose primary key is C0, the pair (LIST_C.A, LIST_D.B) must reference LIST_B (A, B). How do I implement this in SQL Server 2008 R2?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:34:05+00:00Added an answer on May 26, 2026 at 8:34 pm

    I think it is important (both for us and for you) to know the the purpose for adding the additional foreign key?

    Depending on the exact problem you are trying to solve (data validation on entry, cascading deletes, etc) and the flexibility that you have for solving them (ability or inability to alter the data structure), you could implement logical constraints through triggers. We use this approach at times when we just need to catch edge conditions that should rarely, if ever, occur.

    If triggers are insufficient for your situation and foreign keys are required, then about the only option that you have left (without redesigning all of the tables) is to store LIST_C.A into LIST_D and then create the FKey back to LIST_B.

    The other option is to redesign it such that you have intermediate tables that contain the appropriate links between all of the tables, but it doesn’t sound like this is desirable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I create a table with two sections. Each section has four cells.I want to
I have four tables I want to join and get data from. The tables
I've the following question: This is my Create-table: CREATE TABLE `mod_users` ( `u_id` int(11)
Given four (x,y) pairs that represent the four corners of an arbitrary polygon (quadrilateral)
Given an array like {one two, three four five}, how'd you calculate the total
Given a select with multiple option's in jQuery. $select = $(<select></select>); $select.append(<option>Jason</option>) //Key =
I’ve a database which has four tables, for the sake of simplicity, I will
I have those tables Node (#id, route_id, lat, lng) Route(#id) And I have four
I have a table with data : id one two three four five six
What has been happening with the four big P2P distributed hash table (DHT) overlay

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.