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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:32:49+00:00 2026-06-01T13:32:49+00:00

I am working on my SQL, and I have the following statement: 1 SELECT

  • 0

I am working on my SQL, and I have the following statement:

1    SELECT c.credit_display, t.title, t.provider
2       FROM credits c
3           INNER JOIN title t 
4           ON c.vendor_id = t.vendor_id
5       WHERE c.position = 'Director' and t.provider = 'Premiere'
6           INTO OUTFILE '/var/tmp/file.csv'
7           FIELDS TERMINATED BY ','

I was wondering what the correct formatting would be with regards to tabs. What is the suggested practice for when to indent (for example, should the third line be two tabs or three?).

  • 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-01T13:32:51+00:00Added an answer on June 1, 2026 at 1:32 pm

    This is all highly subjective.

    Since the INTO OUTFILE and FIELDS options belong to the entire SELECT statement, I probably wouldn’t indent them beneath the WHERE clause, but rather at the leftmost position (no indentation)

    Since you have multiple WHERE conditions, you may indent each on a new line. I would apply the same to SELECT columns and FROM tables. The ON clause in the JOIN is indented beneath the JOINed table it applies to.

    SELECT
       /* each column on its own line */
       /* unless it is only 1 column */
       c.credit_display, 
       t.title, 
       t.provider
    FROM
       credits c
       INNER JOIN title t 
          /* ON clause indented beneath the join */
          ON c.vendor_id = t.vendor_id
    WHERE 
       /* each condition on its own line */
       c.position = 'Director'
       AND t.provider = 'Premiere'
    /* This apply to the entire statement so I would not indent them
    INTO OUTFILE '/var/tmp/file.csv'
      /* You might indent this and other LINES TERMINATED BY options 
         beneath the OUTFILE line */
      FIELDS TERMINATED BY ','
    

    Indentation is a very subjective matter, and the best thing to do is come to agreement with your team on how you are all indenting code.

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

Sidebar

Related Questions

I have the following sql statement that is working properly. SELECT * FROM table
I have the following SQL statement: USE ws_results_db_2011_09_11_09_06_24;SELECT table_name FROM INFORMATION_SCHEMA.Tables WHERE table_name like
I have the following SQL statement: mysql_query(SELECT * FROM `friends` WHERE friend1='$username' OR friend2='$username'
I have following SQL code: SELECT m.email FROM members as m WHERE exists (
I have the following SQL statement which was working perfectly until I moved it
I have the following Execution statement which creates a table (using data from another
I've got the following SQL statement that I am working on. I've trimmed it
I have written a working T-SQL MERGE statement. The premise is that Database A
I have SQL query, which is working nice on Oracle and MSSQL. Now I'm
I'm working on SQL server 2005 and I have a very simple stored procedure:

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.