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.
- Readability counts.
- Explicit is better than implicit.
- Simple is better than complex.
- Complex is better than complicated.
- Flat is better than nested.
- Errors should never pass silently.
- Unless explicitly silenced.
- Predictable is better than flexible.
- Modular is better than monolithic.
- Common Table Expressions are a seriously great idea - let's do more of those!
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. ↩