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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:47:22+00:00 2026-05-27T11:47:22+00:00

Say TABLE-A can have one or more rows in TABLE-B, which can have one

  • 0

Say TABLE-A can have one or more rows in TABLE-B, which can have one or more rows in TABLE-C, which can have one or more rows in TABLE-D … and so on.

Say I am at TABLE-Z and need to know details about TABLE-A. Do I make a SQL query that works from TABLE-Z all the way to TABLE-A? At some point, maybe it would be nice if, say, TABLE-Z had a FK to TABLE-A so that querying won’t be so painful. However, if I put that FK, I think I would be breaking normalization, right?

General advice on how to deal with this?

  • 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-27T11:47:23+00:00Added an answer on May 27, 2026 at 11:47 am

    If you use composite Primary Keys (which would actually happen if you modelled the design correctly before creating any tables) then the key from TableA is already contained in TableZ (as the left most column).

    However, folk typically add a surrogate key without understanding why. So this you need to join all 26 tables to establish the link between TableA and TableZ

    An extra FK between TableA and your TableZ may conflict with some intermediate foreign key;: this is why denormalised (or unnormalised) data has inherent risks and should be used judiciously.

    However, you wouldn’t typically have 26 levels of nested table. Working with 2, 3 or even 6 way primary keys means I can join TableA to TableF without any intermediate tables.

    Personally, I’d use composite keys and avoid an extra FK unless I had a known, reproducible and demonstrable bottleneck. Most databases won’t notice any difference.. so don’t optimise just yet

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

Sidebar

Related Questions

I have done fastload for table which has more than one column (I did
i have a table say, Table1 and one more table say, ErrorTable1. ErrorTable1 is
We have a SQL server 2008 and one of the tables, say table A
Say I have a table called myTable. What is the SQL command to return
I have a question about the SQL standard which I'm hoping a SQL language
Let's say that we have one table with a field called sales_total and another
I have a database no more than say 100k which I'd like to use
Say I have a one-to-many relationship between clients and addresses. Clients can have multiple
Say I have 2 tables: Customers and Orders. A Customer can have many Orders.
Say a table has several subclass types. How can I see all columns from

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.