0 votes
1 view
in SQL by (43.7k points)
Can anyone tell me what is WITH CTE in SQL?

1 Answer

0 votes
by (103k points)

A CTE (Common Table Expression) is used to define a temporary result set which you can use in a SELECT statement.  It provides a convenient way to manage complicated queries.

CTE is defined within the statement using the WITH operator.  You can define one or more common table expressions like this.

Here is an example of one CTE:

WITH Employee_CTE (EmployeeNumber, Title)

AS

(SELECT NationalIDNumber, JobTitle

 FROM   HumanResources.Employee)

SELECT EmployeeNumber, Title

FROM   Employee_CTE

If you want to learn SQL technical skills, check out this SQL Training course by Intellipaat.

Also, watch this video on SQL to understand more:

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...