Difference between View and CTE
Views can be indexed but CTE can't. So this is one important point.
CTE work excellent on tree hierarchy
i.e. recursive
Also, consider views when dealing with complex queries. Views being a physical object on database (but does not store data physically) and can be used on multiple queries, thus provide flexibility and centralized approach. CTE, on the other hand are temporary and will be created when they are used; that's why they are called as inline view.
Post a Comment
0 Comments