Skip to content
Tako Lee edited this page Feb 16, 2014 · 10 revisions
  • Order by items in one line
  • First item in the same line as ORDER BY keyword

    SELECT * FROM Customers
    ORDER BY Country,CustomerName;
  • First item in new line, indented from 1 to n

    SELECT * FROM Customers
    ORDER BY 
      Country,CustomerName;
  • Stacked order by items
  • First item in the same line as ORDER BY keyword

    • Comma at the end of line

      SELECT * FROM Customers
      ORDER BY Country,
               CustomerName;
    • Comma at the begin of line, comma align with first item.

      SELECT * FROM Customers
      ORDER BY Country
               ,CustomerName;
    • Comma at the begin of line, align items.

      SELECT * FROM Customers
      ORDER BY Country
              ,CustomerName;
    • Comma at the begin of line, align items, space between comma and item from 1 to n.

      SELECT * FROM Customers
      ORDER BY Country
             , CustomerName;
  • First item in new line, indented from 1 to n

    • Comma at the end of line

      SELECT * FROM Customers
      ORDER BY 
         Country,
         CustomerName;
    • Comma at the begin of line, comma align with first item.

      SELECT * FROM Customers
      ORDER BY 
          Country
          ,CustomerName;
    • Comma at the begin of line, align items.

      SELECT * FROM Customers
      ORDER BY 
          Country
         ,CustomerName;
    • Comma at the begin of line, align items, space between comma and item from 1 to n.

      SELECT * FROM Customers
      ORDER BY 
         Country
       , CustomerName;

Clone this wiki locally