PostgreSQL - Views and Materialized ViewsWhich condition must be true for a view in PostgreSQL to be updatable?AThe view must include at least one JOIN between tables.BThe view must use GROUP BY clauses.CThe view must be based on a single table without any aggregate functions.DThe view must contain UNION statements.Check Answer
Step-by-Step SolutionSolution:Step 1: Understand updatable view basicsUpdatable views in PostgreSQL require a simple structure, typically based on a single table without aggregates or joins.Step 2: Analyze the optionsOptions A, C, and D include joins, grouping, or unions, which make views non-updatable by default.Final Answer:The view must be based on a single table without any aggregate functions. -> Option CQuick Check:Updatable view condition = single table, no aggregates [OK]Quick Trick: Updatable views need simple single-table SELECTs [OK]Common Mistakes:Thinking joins allow updates through viewsAssuming GROUP BY views are updatableBelieving UNION views can be updated
Master "Views and Materialized Views" in PostgreSQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PostgreSQL Quizzes Aggregate Functions and GROUP BY - GROUPING SETS for multiple groupings - Quiz 7medium Aggregate Functions and GROUP BY - FILTER clause for conditional aggregation - Quiz 2easy Common Table Expressions - Recursive CTE for hierarchical data - Quiz 5medium Common Table Expressions - CTE with INSERT, UPDATE, DELETE (writable CTEs) - Quiz 2easy Common Table Expressions - CTE materialization behavior - Quiz 4medium Full-Text Search - to_tsvector for document conversion - Quiz 11easy JSON and JSONB - JSONB containment (@>) operator - Quiz 12easy Views and Materialized Views - Views with CHECK OPTION - Quiz 12easy Views and Materialized Views - CREATE MATERIALIZED VIEW - Quiz 4medium Window Functions in PostgreSQL - Practical window function patterns - Quiz 7medium