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

  • Home
  • SEARCH
  • 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 301741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:02:01+00:00 2026-05-12T07:02:01+00:00

What I mean is, If I had the following schema: create table tableA( A_id

  • 0

What I mean is, If I had the following schema:

create table tableA(
    A_id   number not null primary key
);

create table tableB(
    B_id   number not null primary key,
    A_id   number not null references tableA(A_id),
    B_data text   not null
);

create table tableC(
    C_id   number not null primary key,
    A_id   number not null references tableA(A_id),
    C_data text   not null
);

If I wanted to retrieve B_data and C_data using the relationships described here, is there any difference between the following:

select
    b.B_data,
    c.C_data
from
    tableB b
    inner join tableC c
        on b.A_id = c.A_id;

and:

select
    b.B_data,
    c.C_data
from
    tableB b
    inner join tableA a
        on b.A_id = a.A_id
    inner join tableC c
        on a.A_id = c.A_id;

I suspect that most databases will optimise either query to be the same, but are there cases where the foreign key constraints to tableA will make joining via tableA much more efficient? Are there any cases where these queries could produce different results?

  • 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-12T07:02:01+00:00Added an answer on May 12, 2026 at 7:02 am

    You may as well join them directly. Foreign key constraints don’t do anything to make joins more efficient; indexes do that, which (depending on DBMS) may be a separate matter from foreign keys. Either way, if there’s an index to work with, you have it regardless of whether you’re going by your foreign key.

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

Sidebar

Ask A Question

Stats

  • Questions 250k
  • Answers 250k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer First things first. Your code uses list concatenation to add… May 13, 2026 at 9:15 am
  • Editorial Team
    Editorial Team added an answer How about: // adjusted from suggestions IF Month (ldt_OldDate) =… May 13, 2026 at 9:15 am
  • Editorial Team
    Editorial Team added an answer I would verify that you are calling PointToScreen on the… May 13, 2026 at 9:15 am

Related Questions

I recently took a class at school where we had to learn Scheme to
I am currently using Q-Learning to try to teach a bot how to move
Here is what I am trying to accomplish: To Copy, press and release Caps
When creating indexes for an SQL table,if i had an index on 2 columns

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.