DEV Community

Discussion on: SQL tips for beginners; what I learned after 10+ years of occasionally writing queries and schemas as a web dev

Collapse
 
taijidude profile image
taijidude

Thank you for the post. I need to go and have another look at ctes.

Collapse
 
rap2hpoutre profile image
Raphaël Huchet

Thank you for your feedback. Yes, CTE is a game changer in writing queries. I sometimes have 4 or 5 parts broken down before the actual query, and it's still easy to read. Side note, I worked with a junior colleague who easily wrote super complex query in a readable way thanks to this syntax.

I feel like the example is documentation is good enough to highlight the benefits: postgresql.org/docs/current/querie...

Also, this course helped me: masterywithsql.com/ (still it's not free)

Collapse
 
taijidude profile image
taijidude

Thanks for mentioning it. Before i had the false assumption, that CTES are only usefull if i wanted to do a recursive query.