Common Table Expresion

Description

A common table expression permits defining a result table with a table-name that can be specified as a table name in any FROM clause of the fullselect that follows.

Click here to navigate to the IBM DB2 docs page for this syntax.

Snowflake Does not support Common table expression. The output query can be malformed

Grammar Syntax

Sample Source Patterns

IBM DB2

DELETE FROM (
   WITH CTE (EMPNO, SALARY, COMM) AS
   (SELECT EMPNO, SALARY, COMM
	FROM
		EMPLOYEE)
   SELECT
      *
   FROM
      CTE
)

Snowflake

DELETE FROM
-- ** MSC-ERROR - MSCEWI5008 - DELETE FROM SELECT STATEMENT IS NOT SUPPORTED. **
--            (
--   WITH CTE (EMPNO, SALARY, COMM) AS
--   (SELECT EMPNO, SALARY, COMM
--	FROM
--		EMPLOYEE)
--   SELECT
--      *
--   FROM
--      CTE
--)

Last updated