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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:17:42+00:00 2026-05-16T00:17:42+00:00

Ignoring version, what are the best practices for formatting SQL code? I prefer this

  • 0

Ignoring version, what are the best practices for formatting SQL code?

I prefer this way (method A):

select col from a inner join b on a.id = b.id inner join c on b.id = c.id

a colleague prefers another (method B):

select col from a inner join (b inner join c on b.id=c.id) on a.id = b.id

I’d like to know if there is any difference – the query optimiser appears to generate the same execution plan for both. So maybe it is just readability?

This is the first time I’ve seen SQL written using method B, does anyone else write SQL like this? Personally I find it really difficult to read method B.

EDIT: Please note the code is on one line and in upper case to make both more comparable for the purpose of this question.

  • 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-16T00:17:42+00:00Added an answer on May 16, 2026 at 12:17 am

    I think A is more readable, and most sample code out there uses that style. Both parse the same and product the same query plan, so as far as SQL Server is concerned, there is no difference.

    I normally also uppercase keywords and indent for readability:

    SELECT col 
    FROM a 
      INNER JOIN b 
        ON a.id = b.id  
      INNER JOIN c 
        ON b.id = c.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ignoring unsafe code, .NET cannot have memory leaks. I've read this endlessly from many
(This question is about the best way to temporarily and programatically keep new records
Server: jboss-5.1.0 Java Version: jdk1.6.0_14 Deployment Method: ant v1.7 Error: 08:40:04,260 WARN [ZipEntryContext] IGNORING:
It appears that the Entity Framework (latest version from NuGet) may be ignoring the
How should this code behave? It calls generic function ignoring my overload if I
Why does this empty the text immediately (ignoring delay)? $('#error_box_text').html('error text').delay(5000).html('') # jQuery 1.4
Is it possible to read alphanumeric characters only from the given input line ignoring
Based on this , how would you make ignoring parameters more succint? var m
I am calling a REST webservice. The response looks something like this: <?xml version=\1.0\
git version 1.7.7 I have dropbox git repository. From my works computer karl-sun I

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.