CTE stands for Common table expression. sometimes it is very useful when you are writing a complex query.
Consider a case where you want data from more the 4 tables and then you want to insert into a temp table based on some conditions and then you want to return the result.
In such kinds of scenarios CTE is the best option..