Bird
0
0

Which of the following is the correct syntax to declare a CTE as non-materialized in PostgreSQL?

easy📝 Syntax Q3 of 15
PostgreSQL - Common Table Expressions
Which of the following is the correct syntax to declare a CTE as non-materialized in PostgreSQL?
AWITH cte AS NOT MATERIALIZED (SELECT * FROM table)
BWITH cte AS INLINE (SELECT * FROM table)
CWITH cte AS MATERIALIZED (SELECT * FROM table)
DWITH cte AS NOT MATERIALIZED SELECT * FROM table
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct syntax for non-materialized CTE

    PostgreSQL uses NOT MATERIALIZED inside parentheses after AS.
  2. Step 2: Check syntax correctness

    WITH cte AS NOT MATERIALIZED (SELECT * FROM table) correctly uses 'AS NOT MATERIALIZED (SELECT ...)', others are invalid or missing parentheses.
  3. Final Answer:

    WITH cte AS NOT MATERIALIZED (SELECT * FROM table) -> Option A
  4. Quick Check:

    Non-materialized CTE syntax = NOT MATERIALIZED [OK]
Quick Trick: Use NOT MATERIALIZED inside parentheses after AS [OK]
Common Mistakes:
  • Using INLINE keyword (not valid)
  • Omitting parentheses around SELECT
  • Writing NOT MATERIALIZED without AS

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes