Bird
0
0

Consider the view:

medium📝 Debug Q6 of 15
SQL - Views
Consider the view:
CREATE VIEW v_revenue AS SELECT product_id, SUM(sales_amount) AS total_sales FROM sales GROUP BY product_id;

Why is this view not updatable?
ABecause it includes a WHERE clause
BBecause it selects from multiple tables
CBecause it uses an aggregate function and GROUP BY clause
DBecause it uses a subquery in the SELECT list
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the view definition

    The view uses SUM(sales_amount) and GROUP BY product_id.
  2. Step 2: Understand updatability rules

    Views with aggregate functions and GROUP BY are not updatable because the underlying rows cannot be uniquely identified for updates.
  3. Final Answer:

    Because it uses an aggregate function and GROUP BY clause -> Option C
  4. Quick Check:

    Aggregates and GROUP BY block updates [OK]
Quick Trick: Aggregates and GROUP BY make views non-updatable [OK]
Common Mistakes:
MISTAKES
  • Assuming WHERE clause blocks updates
  • Confusing multiple tables with aggregates
  • Thinking subqueries always block updates

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes