What is CTE "Common table expression"

Common Table Expression:-

Is a temporary result set where we can use for execution like Insert, Update, Delete and Select.

CTE always begin => ;with

Syntax:-

     ;with                                                        => Start with a with.
     mycteexample(Name, Age)                    =>Coloumn Name reqiured to display
     as                                                         
     (
        select Name, Age from Employee      => SQL STATEMENT
     )
     select * from mycteexample
     

Share this

Previous
Next Post »