re: Why I use SQL Common Table Expressions (CTEs) VIEW POST


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.


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

Code of Conduct Report abuse