Bird
0
0

You created a view with:

medium📝 Debug Q14 of 15
SQL - Views
You created a view with:
CREATE VIEW ActiveUsers AS SELECT id, name FROM Users WHERE active = 1;
But running SELECT * FROM ActiveUsers; gives an error: ERROR: relation "activeusers" does not exist
What is the most likely cause?
AThe view was not created successfully or was dropped
BThe SELECT query inside the view has syntax errors
CThe Users table does not have an 'active' column
DYou must refresh the view before selecting from it
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the error message

    The error says the relation (view) "activeusers" does not exist, meaning the view is missing.
  2. Step 2: Consider causes for missing view

    This usually means the view was never created or was dropped. Syntax errors or missing columns cause errors during creation, not this runtime error. Views do not require refreshing.
  3. Final Answer:

    The view was not created successfully or was dropped -> Option A
  4. Quick Check:

    Missing view = creation failed or dropped [OK]
Quick Trick: Check if view exists before querying it [OK]
Common Mistakes:
MISTAKES
  • Assuming syntax errors cause this runtime error
  • Thinking views need refreshing like materialized views
  • Ignoring case sensitivity or schema issues

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes