Managing complex business logic in SQL using Common Table Expressions (CTEs) | Hacker News Reader