Open two files in the same project and you can find the same query written two ways: in one, the keywords shout in upper case; in the other, they sit in lower case like the rest of the code. Both files run. Both return the same rows. Yet teams argue about which one is right, as if the database cared. It does not, and understanding why it does not turns the argument from a matter of taste defended loudly into a style choice made calmly.

This guide compares the two styles on the only ground where they differ: readability. It shows what the free SQL Formatter on Ovatly produces, and it covers the honest trade-off for teams whose house style is the other one. What it will not do is declare a winner on correctness or speed, because there is nothing to win there.

Contents

  • Quick answer
  • The language does not care
  • The case for uppercase keywords
  • The case for lowercase keywords
  • What the SQL Formatter does
  • How to format a query, step by step
  • Worked example: one query, two casings
  • Limitations and trade-offs
  • Common mistakes
  • FAQs
  • Conclusion

Quick answer

SQL keywords are case-insensitive: SELECT and select are the same instruction, and neither casing runs faster or more correctly than the other. The choice is pure readability style. The SQL Formatter upper-cases keywords and lays each clause on its own line, while leaving your identifiers, values and string literals exactly as written. If your team standard is lowercase keywords, format for layout and apply your casing in your own editor: consistency inside one codebase matters more than which side the convention falls on.

The language does not care

SQL treats its keywords without regard to case. A query filters, sorts and limits identically whether its keywords are typed in upper case, lower case, or a mixture nobody should imitate. The database parses the words, not their casing, and the statement it receives after formatting is equivalent to the one before: formatting changes layout and keyword case only.

Uppercase keywords are not more official, because the standard does not run on casing. Lowercase keywords are not more modern in any way a database can detect. And no casing makes a query faster, because the text is parsed once into the same internal form either way. Whatever is left to discuss lives entirely on the reader's side of the screen.

The case for uppercase keywords

The argument for upper case is separation. In a formatted query, keywords are the skeleton: they mark what kind of clause you are looking at. Upper-cased, they stand apart from identifiers at a glance, so a reader scanning a long statement can find the WHERE clause or the ORDER BY without reading every word. In a three-line select that is a nicety; in a forty-line statement with joins and a subquery, it is the difference between scanning the structure and reading the whole thing linearly.

Uppercase keywords are also the long-standing convention in SQL documentation, manuals and teaching material, which means many readers arrive already trained to parse them. Queries that follow the convention are easier to hand over and document for those readers.

The case for lowercase keywords

The argument for lower case is calm. Queries live inside application code, configuration files and templates written in languages whose keywords are lowercase, and SQL written the same way sits quietly among them instead of shouting. Some readers find lowercase text easier to read in bulk, and some find keywords blending in a feature: the eye goes to the table and column names, which carry the meaning specific to this query, rather than to the boilerplate words every query shares.

There is a consistency argument too. If every other language in the stack is lowercase and the team's editors and linters already enforce that style, then SQL in lowercase is the convention the team can actually hold. A style nobody maintains is not a style; it is a wish.

What the SQL Formatter does

The SQL Formatter has taken the uppercase side. Paste a statement in and it lays the query out with keywords in upper case and clauses on their own lines, across eight dialects including PostgreSQL, MySQL and SQL Server. Keywords are upper-cased; your identifiers, values and string literals are left exactly as written, so a column named usrName and a filter value like 'Paid' keep their original case. The tool does not offer a lowercase mode: upper-casing is part of the layout it produces.

That behaviour defines the trade-off cleanly. If your house style is uppercase keywords, the formatter enforces it mechanically. If your house style is lowercase, the formatter still gives you the clause layout, the indentation and the diff-friendly shape, and the casing pass becomes a step you apply in your own editor afterwards.

How to format a query, step by step

  1. Open the SQL Formatter and paste your SQL statement into the input box.
  2. Choose the dialect your database uses.
  3. Press Format SQL.
  4. Read the result: keywords in upper case, clauses on their own lines, your identifiers and values untouched.
  5. Copy or download the formatted query. If your team standard is lowercase keywords, apply that casing in your editor as the final step.

Worked example: one query, two casings

Here is a short query written in the lowercase style, as it might sit inside application code:

select order_id, total from orders where customer_id = 42 and status = 'paid' order by created_at desc

Run it through the formatter and the same statement comes back in the tool's uppercase layout:

SELECT
  order_id,
  total
FROM
  orders
WHERE
  customer_id = 42
  AND status = 'paid'
ORDER BY
  created_at DESC

Read the second version for what changed and what did not. The keywords stand out as clause markers, and each clause starts on its own line, so the query's shape is visible at a glance. Meanwhile order_id, customer_id and created_at are exactly as written, and the string literal 'paid' is still lowercase, because the formatter upper-cases keywords only. The database would accept either version and do the same work; the difference exists purely for the person reading.

Limitations and trade-offs

The honest limitation is the flip side of a firm convention: this formatter always upper-cases keywords. Teams committed to lowercase keywords get no setting to change that, so their workflow gains a step, reformatting the output in their own editor to match house style. That is a real cost, and a team that formats SQL all day in a lowercase codebase may reasonably prefer a tool that follows its convention natively.

The layout still depends on picking the right dialect. Some syntax, like MySQL backticks or T-SQL brackets, only parses correctly in its own dialect, whatever casing you prefer. And formatting settles nothing about the query itself: the formatter does not connect to any database and cannot tell you whether the statement will run or return rows.

Common mistakes

  • Claiming one casing is faster or more correct. It is neither. The database parses both to the same statement, and performance arguments about keyword case have nothing underneath them.
  • Mixing casings inside one codebase. Some files uppercase, some lowercase, some mixed within a single query: this is the one style that reliably slows readers down, because nothing can be scanned on habit.
  • Assuming the formatter renamed your columns. It did not. Keywords are upper-cased; identifiers, values and string literals are left exactly as written, so any odd casing in the output was odd in the input.
  • Hand-editing case query by query. Manual casing drifts. Pick the convention, then let a formatter or an editor rule apply it the same way every time.
  • Arguing the style instead of writing it down. An unwritten convention produces the mixed codebase above. A written one ends the debate in a sentence.

FAQs

Does keyword case change how a query runs? No. SQL keywords are case-insensitive, so SELECT and select are the same instruction to the database. Formatting changes layout and keyword case only, and the statement your database receives is equivalent.

Can the SQL Formatter produce lowercase keywords? No. This formatter upper-cases keywords as part of its layout. If your team standard is lowercase keywords, format for readability here and apply your own casing in your editor afterwards.

Does upper-casing change my table and column names? No. Keywords are upper-cased; your identifiers, values and string literals are left exactly as written, so a column called usrName or a value like 'Paid' keeps its original case.

Which style should my team use? The one you can apply consistently. A codebase where every query follows the same convention is easier to scan and diff than a mix, whichever side the convention falls on.

Is my SQL uploaded anywhere? No. Formatting runs entirely in your browser.

Conclusion

Keyword case is a reading convention wearing the costume of a technical argument. Strip the costume away and the decision is simple: pick the casing your team can hold, and let tooling apply it consistently. The SQL Formatter holds the uppercase side for you, clause by clause. For a query arriving in the least readable form of all, buried in a log line when something has already gone wrong, the companion guide on formatting a SQL query pasted from an error log walks through that workflow, and the rest of this series lives in the Developer Tools guides archive.