DEV Community

[Comment from a deleted post]
Collapse
 
aarone4 profile image
Aaron Reese

Other benefits:
You can test a CTE indendently.from the rest of the code
You can 'chain' them together so you can break down complex business rules into discreet steps
They support window functions such as RANK() OVER() so you can use the windowed value in the where clause.
They can be self referencing which is great for hierarchical data.

Collapse
 
helenanders26 profile image
Helen Anderson

Thanks for added detail, even more reason to use CTEs in complex queries :)