I have a question about CTEs. You can start of a sql statement by WITH and then you can construct one or multiple CTE queries, which you then in the end can make (in this case) a select on.
My question is: will all CTE queries be executed or only the ones who are being used?
E.g.
WITH cte_1
as (
Select * from table1
),
cte_2
as (
Select * from table2
)
Select * from cte_1
Will this mean that a select will be executed on table1 and table2?