title: When to use Common Table Expression (CTE)
body: <p>I have begun reading about <em>Common Table Expression</em> and cannot think of a use case where I would need to use them. They would seem to be redundant as the same can be done with derived tables. Is there something I am missing or not understanding well? Can someone give me a simple example of limitations with regular select, derived or temp table queries to make the case of CTE? Any simple examples would be highly appreciated.</p>