Ashok

Ashok

  • NA
  • 51
  • 21.2k

why we are using CTE?

Feb 22 2018 12:05 AM
Hi All,
 
 
why we are using cte?
and when we are using it?
 
Thanks All 
 

Answers (3)

2
Rajneesh Chaubey

Rajneesh Chaubey

  • 0
  • 2.9k
  • 235.6k
Feb 22 2018 12:11 AM
There are many advantages of CTE.
One benefit is that with the help of CTE, we can create recursive query.
Visit this for detailed explanation:https://stackoverflow.com/questions/4740748/when-to-use-common-table-expression-cte
1
Manav Pandya

Manav Pandya

  • 0
  • 19.9k
  • 2.3m
Feb 22 2018 1:46 AM
Hello
 
Well CTE is used as alternative of Subqueries or views
 
For more detail you can follow :
 
https://www.red-gate.com/simple-talk/sql/t-sql-programming/sql-server-cte-basics/
 
http://www.c-sharpcorner.com/UploadFile/af66b7/cte/
 
I hope it helps
 
Thanks 
0
Sanwar Ranwa

Sanwar Ranwa

  • 3
  • 71.1k
  • 12.3m
Feb 22 2018 1:53 AM
https://www.essentialsql.com/introduction-common-table-expressions-ctes/