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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:24:40+00:00 2026-06-12T12:24:40+00:00

What are the differences between the two queries? SELECT CountryMaster.Id FROM Districts INNER JOIN

  • 0

What are the differences between the two queries?

   SELECT     CountryMaster.Id
   FROM       Districts INNER JOIN
   CountryMaster ON Districts.CountryId = CountryMaster.Id

   SELECT     CountryMaster.Id
   FROM       CountryMaster INNER JOIN
   Districts ON Districts.CountryId = CountryMaster.Id  

I know the output will be same, but I want to know is there any drastic effects of the same if I neglect positions of tables and columns in complex queries or tables having tons of data like hundreds of thousands of rows.

  • 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-06-12T12:24:41+00:00Added an answer on June 12, 2026 at 12:24 pm

    No difference whatsoever. The order of the joins is irrelevant. The query optimizer inside the database engine will decide on a merge plan to actually process the records from the two tables based on the stored statistics for the data in those tables.
    In fact, in many cases, the query optimizer’s will generate exactly the same plan for both a query phrased using joins as it would for a query phrased with a correlated sub-query.
    The lesson here I have learned is:

    Always start with the syntax, or representation, that most clearly represents the meaning of the process you are trying to create, and trust the query optimizer to do its job. Having said that, the query optimizer is not perfect, so if there is a performance issue, use the query show plan with alternate constructions and see if it improves…

    One quick comment on performance of inner vs. outer joins. It is simply not true that inner joins are intrinsically faster than outer joins. The relative performance depends entirely on which of the three types of processing joins are used by the query engine;
    1. Nested Loop Join, 2., Merge Join, or 3. Hash Join.
    The Nested Loop join, for example, is used when the set of records on one side of the join is very much smaller than on the other side, and the larger set is indexed on the join column[s]. In this case, if the smaller set is the “outer” side, then an outer join will be faster. The reason is that the nested loop join takes the entire set of records from that smaller set, and iterates through each one, finding the records from the larger set that match. An inner join has to perform a second step of removing rows from the smaller side when no matches were found in the larger set. The outer join does not do this second step.

    Each of the three possible types of join processes has its own characterisitic behavior patterns… See Nested Loop Joins, Merge Joins and Hash Joins for the details.

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

Sidebar

Related Questions

I have two queries serving the same purpose. SELECT * FROM #user INNER JOIN
i have two queries select * from T where DATE_OF between to_date ('01.02.2012 00:00:00',
Is there a performance difference between the two queries below? SELECT * FROM mytable
I cannot effectively understand the difference between these two queries. select * from person
Is there any performance difference between the two following queries: SELECT foo,bar FROM table
In MySQL, is there a difference between those 2 queries? SELECT * FROM ....
What's the difference between these two queries: SELECT `threads`.`id` AS `threads.id` , `posts`.`id` ,
I wanted to know the difference between these two SQL queries.. Note: Foreign Key
Is there a difference in performance between these two queries? --= operator SELECT COL1,
Somebody tell me what's the difference between two queries: Version A select p.LastName, o.OrderNo

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.