River Style vs Axis Style

Space River Style

River formatting is a style of SQL code formatting where each major SQL clause (e.g., SELECT, FROM, WHERE) is placed on a new line, and the elements within those clauses are indented consistently. The result is a „river-like“ appearance where the code flows vertically down the page, resembling cascading text.

Example: River Style

				
					SELECT  
    customer_id,  
    first_name,  
    last_name,  
    SUM(order_total) AS total_spent  
FROM  
    customers c  
INNER JOIN  
    orders o  
    ON c.customer_id = o.customer_id  
WHERE  
    order_date >= '2024-01-01'  
    AND order_date <= '2024-12-31'  
GROUP BY  
    customer_id,  
    first_name,  
    last_name  
HAVING  
    SUM(order_total) > 500  
ORDER BY  
    total_spent DESC;  

				
			

This formatting style emphasizes readability and clarity, especially for complex SQL queries. By structuring SQL statements in this manner, developers can quickly distinguish between different parts of the query and follow the logical flow without needing to scan horizontally.

Axis Style

Axis formatting is a style of SQL code formatting where key elements of a query (such as column names, conditions, and values) are aligned along vertical axes. This creates a tabular-like appearance, making it easy to visually scan and compare elements within the query. The goal is to achieve a clean, organized layout that emphasizes alignment and symmetry.

Example: Axis Style

				
					_   SELECT customer_id ,
           first_name  ,
           last_name   ,
           SUM(order_total) AS total_spent
      FROM customers        c
INNER JOIN orders o
        ON c.customer_id = o.customer_id
     WHERE order_date    >= '2024-01-01'
       AND order_date    <= '2024-12-31'
  GROUP BY customer_id ,
           first_name  ,
           last_name
    HAVING SUM(order_total) > 500
  ORDER BY total_spent DESC;
				
			

This formatting style is particularly useful for structured environments where SQL queries are written to be consistently formatted across a team or organization.

Switch between Space River Style & Axis Style with one click

axisFormat 1