Skip to content


The Zen of SQL


Inspired by the Python equivalent (PEP20 - The Zen of Python), and also using it as a starting point, the TFSQL101 are the core guiding principles which are central to writing clean, clear, well-structured and easy to maintain data transformations in SQL. These are the guiding principles for all SQL code written by our functions and humans.


  1. Readability counts.
  2. Explicit is better than implicit.
  3. Simple is better than complex.
  4. Complex is better than complicated.
  5. Flat is better than nested.
  6. Errors should never pass silently.
  7. Unless explicitly silenced.
  8. Predictable is better than flexible.
  9. Modular is better than monolithic.
  10. Common Table Expressions are a seriously great idea - let's do more of those!

  1. Whilst the Python PEP20 actually only contains 19 aphorisms, the Transformation Flow SQL 10 (TFSQL10) contains exactly 10. This is because SQL is essentially an abstraction on set theory, so needs to be internally consistent. And a Python is a snake.