🎉 SQLFluff Online 🎉

SQLFluff is a SQL formatter that is implemented in Python. You can use this app to format one-off, adhoc sql that might not be worth saving to a file. Or you can use it to see what SQLFluff thinks of your queries. It's up to you!

You can check out the source code for this application on GitHub (click).

Paste your SQL and select your dialect. Hit that button and find your fixed SQL with the associated linter errors. Enjoy, friends 🌝.

Your Terrible SQL

SQLFluff is maintained by a group of talented attractive and selfless people who are all driven by a common disdain for poorly formatted SQL. If you like fluff's treatment of your queries, feel encouraged to check out our group on GitHub!

This app runs on SQLFluff version 1.4.5, and applies all rules in that version. Here is a list of them:

Rule Description
L001 Unnecessary trailing whitespace.
L002 Mixed Tabs and Spaces in single whitespace.
L003 Indentation not consistent with previous lines.
L004 Incorrect indentation type.
L005 Commas should not have whitespace directly before them.
L006 Operators should be surrounded by a single whitespace.
L007 Operators should follow a standard for being before/after newlines.
L008 Commas should be followed by a single whitespace unless followed by a comment.
L009 Files must end with a single trailing newline.
L010 Inconsistent capitalisation of keywords.
L011 Implicit/explicit aliasing of table.
L012 Implicit/explicit aliasing of columns.
L013 Column expression without alias. Use explicit `AS` clause.
L014 Inconsistent capitalisation of unquoted identifiers.
L015 'DISTINCT' used with parentheses.
L016 Line is too long.
L017 Function name not immediately followed by parenthesis.
L018 'WITH' clause closing bracket should be on a new line.
L019 Leading/Trailing comma enforcement.
L020 Table aliases should be unique within each clause.
L021 Ambiguous use of 'DISTINCT' in a 'SELECT' statement with 'GROUP BY'.
L022 Blank line expected but not found after CTE closing bracket.
L023 Single whitespace expected after 'AS' in 'WITH' clause.
L024 Single whitespace expected after 'USING' in 'JOIN' clause.
L025 Tables should not be aliased if that alias is not used.
L026 References cannot reference objects not present in 'FROM' clause.
L027 References should be qualified if select has more than one referenced table/view.
L028 References should be consistent in statements with a single table.
L029 Keywords should not be used as identifiers.
L030 Inconsistent capitalisation of function names.
L031 Avoid table aliases in from clauses and join conditions.
L032 Prefer specifying join keys instead of using 'USING'.
L033 'UNION [DISTINCT|ALL]' is preferred over just 'UNION'.
L034 Select wildcards then simple targets before calculations and aggregates.
L035 Do not specify 'else null' in a case when statement (redundant).
L036 Select targets should be on a new line unless there is only one select target.
L037 Ambiguous ordering directions for columns in order by clause.
L038 Trailing commas within select clause.
L039 Unnecessary whitespace found.
L040 Inconsistent capitalisation of boolean/null literal.
L041 'SELECT' modifiers (e.g. 'DISTINCT') must be on the same line as 'SELECT'.
L042 Join/From clauses should not contain subqueries. Use CTEs instead.
L043 Unnecessary 'CASE' statement.
L044 Query produces an unknown number of result columns.
L045 Query defines a CTE (common-table expression) but does not use it.
L046 Jinja tags should have a single whitespace on either side.
L047 Use consistent syntax to express "count number of rows".
L048 Quoted literals should be surrounded by a single whitespace.
L049 Comparisons with NULL should use "IS" or "IS NOT".
L050 Files must not begin with newlines or whitespace.
L051 Join clauses should be fully qualified.
L052 Statements must end with a semi-colon.
L053 Top-level statements should not be wrapped in brackets.
L054 Inconsistent column references in 'GROUP BY/ORDER BY' clauses.
L055 Use 'LEFT JOIN' instead of 'RIGHT JOIN'.
L056 'SP_' prefix should not be used for user-defined stored procedures in T-SQL.
L057 Do not use special characters in identifiers.
L058 Nested 'CASE' statement in 'ELSE' clause could be flattened.
L059 Unnecessary quoted identifier.
L060 Use 'COALESCE' instead of 'IFNULL' or 'NVL'.
L061 Use '!=' instead of '<>' for "not equal to" comparisons.
L062 Block a list of configurable words from being used.
L063 Inconsistent capitalisation of datatypes.
L064 Consistent usage of preferred quotes for quoted literals.
L065 Set operators should be surrounded by newlines.
L066 Enforce table alias lengths in from clauses and join conditions.
L067 Enforce consistent type casting style.
L068 Queries within set query produce different numbers of columns.
L071 Parenthesis blocks should be surrounded by whitespaces.