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 6013849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:36:29+00:00 2026-05-23T02:36:29+00:00

I have a DB in which there are 4 tables. A -> B ->

  • 0

I have a DB in which there are 4 tables.

A -> B -> C -> D

Current the way I have it is, the Primary Key of A is a foreign key in B. And B would have it’s own Primary Key, which is a foreign key in C, etc etc.

However, C can’t be linked to A without B.

The problem is, a core function of my program involve pulling matching entries from A and D.

Should I include the primary key of A in D too

Doing so will create unnecessary data duplication ‘coz A->B->C->D are hierarchy.
see pic for what D would look like.Proposed Table D

  • 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-23T02:36:30+00:00Added an answer on May 23, 2026 at 2:36 am

    If you take all D-s in relation with given A, I would keep it normalized.

    But if you want specific subset of such D-s and its easy to know which in advance, but time consuming later (eg. if you want all D-s from newest C from newest B), I would prefare storing this shortcut somewhere.

    It does not have to be in D itself (esp. if you don’t want all D-s connected with A).

    If you want to do it to make your queries easier to read and write, then consider view.

    If you want to do it to increase performance, try everything and measure it. (And I’m not expert in performance tuning of SQL, so I have no specific advice beyond that)

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

Sidebar

Related Questions

I have a MySQL Left Join problem. I have three tables which I'm trying
Suppose I have a directory /dir inside which there are 3 symlinks to other
Assuming I have fonts installed which have the appropriate glyphs in them, is there
I have a Map which is to be modified by several threads concurrently. There
There are numerous Agile software development methods. Which ones have you used in practice
I have a table which has an unique key with 2 constraints in it.
Some sites have tables which appends rows when you scroll the browser so that
I have users in my system that can elect to 'hibernate', at which point
I have a logging table which has three columns. One column is a unique
I have a database table (named Topics) which includes these fields : topicId name

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.