Quantcast
Viewing all articles
Browse latest Browse all 207

JOIN vs WITH differences

apologize if there is the same question.

When I started my career, my manager told me that you don't need to use "WITH", you can do anything with "JOIN".

Now I am wondering is it any performance differences between them. Why do I need to use WITH clause?

Update: I am not sure it is the exact comparation that we can use both and check any performance differences but here is an example:

  WITH query_name1 AS (         SELECT ... FROM table_1         )       , query_name2 AS (         SELECT ...           FROM table_2            ...         )    SELECT ... 

vs

Select ... FROM (SELECT ... FROM table_1 LEFT JOIN table_2)

Viewing all articles
Browse latest Browse all 207

Trending Articles