4 ms·
CTE = common table expression, i.e. a WITH clause (possibly recursive) before your SELECT (or other) statement. https://learnsql.com/blog/what-is-common-table-e
by gpvos 4y ago
CTE = common table expression, i.e. a WITH clause (possibly recursive) before your SELECT (or other) statement. https://learnsql.com/blog/what-is-common-table-expression/ https://learnsql.com/blog/what-is-common-table-expression/
- stormdennis 4y agoYes, I didn't know what it was so I had looked it up before I saw yours. The definition I got is below: A common table expression, or CTE, is a temporary named result set created from a simple SQL statement that can be used in subsequent SELECT, DELETE, INSERT, or UPDATE statements.
- gpvos 4y agoI knew about WITH clauses, just didn't know the name.
- xpil 4y ago> (...) in subsequent SELECT, DELETE, INSERT, or UPDATE statements The annoying part is that certain RDMBS engines (MySQL for instance) require you to write the INSERT keyword before any CTEs. So, your T-SQL or PGSQL query: `with cte1 as (...) insert into ... select ... from cte1;` becomes: `insert into ... with cte1 as (...) select ... from cte1;` I know the difference is minor but when you deal with many different DB engines, it is simply annoying.