0

We have been using SQL Server 2014 for our project as a backend source. We have been performing various joins on the tables. We came across a question in one to many and many to one relationship in joins.

Say for example: I have a table named Industry and another table called Products. Industry holds the list of Industry in market and Products holds that industry's multiple products.

Industry

Id
IndustryName
Owner

Products

Id IndustryId ProductId ProductName

From the above tables, I am performing two queries as shown below:

  1. 1 to many

    Select *
    from Industry
    inner join Products 
        on Industry.Id = Product.IndustryId
    
  2. many to 1

    Select * 
    from Product
    inner join Industry 
        on Product.IndustryId = Industry.Id 
    

Among the above which will be more efficient performance wise?

4

No difference. Only the order of the columns in the SELECT list changes.

See related questions:

Changes like this will almost 100% produce the same execution plan.


Communtiy Wiki answer based on an original comment on the question by @ypercube

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.