Bird
0
0

Which of the following is the correct syntax to create a view named active_users showing users with status = 'active'?

easy📝 Syntax Q12 of 15
PostgreSQL - Views and Materialized Views
Which of the following is the correct syntax to create a view named active_users showing users with status = 'active'?
ACREATE VIEW active_users AS SELECT * FROM users WHERE status = 'active';
BCREATE active_users VIEW AS SELECT * FROM users WHERE status = 'active';
CVIEW CREATE active_users AS SELECT * FROM users WHERE status = 'active';
DCREATE VIEW active_users SELECT * FROM users WHERE status = 'active';
Step-by-Step Solution
Solution:
  1. Step 1: Recall the correct CREATE VIEW syntax

    The syntax is: CREATE VIEW view_name AS SELECT ...
  2. Step 2: Match the syntax with options

    CREATE VIEW active_users AS SELECT * FROM users WHERE status = 'active'; matches the correct syntax exactly.
  3. Final Answer:

    CREATE VIEW active_users AS SELECT * FROM users WHERE status = 'active'; -> Option A
  4. Quick Check:

    CREATE VIEW ... AS SELECT ... = B [OK]
Quick Trick: Remember: CREATE VIEW name AS SELECT ... [OK]
Common Mistakes:
  • Swapping keywords CREATE and VIEW
  • Omitting AS keyword
  • Incorrect keyword order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes