1. A computer-implemented method comprising: receiving a query that includes a first common table expression (CTE), wherein the first CTE is an expression in the query having a name and one or more associated definitional statements, wherein the first CTE signifies that a system can compute a result for the query using a query plan that includes a CTE producer operator and a corresponding CTE consumer operator, the CTE producer operator having descendant operators that compute a result of the one or more definitional statements and materialize the result, and wherein the corresponding CTE consumer operator reads the materialized result; identifying a scope of the name of the CTE within the query, the scope being a particular portion of the query from which the name of the CTE can validly be referenced by one or more other statements in the query; generating a query plan that includes a sequence operator having two child operators, wherein the sequence operator computes a result for each of its child operators in order by computing a first result for a first child operator and then computing, using the first result, a second result for a second child operator and returns the second result computed by the second child operator of the sequence operator, wherein the first child operator of the sequence operator includes the CTE producer operator of the CTE, and wherein the second child operator of the sequence operator includes a subtree of the query plan a) that corresponds to the scope of the CTE within the query, and b) includes operations for the one or more other statements in the query that can validly reference the CTE; and computing a result for the query using the query plan.