Bird
0
0

Which of the following is the correct syntax to create a materialized view named mv_customers selecting all columns from customers table?

easy📝 Syntax Q3 of 15
PostgreSQL - Views and Materialized Views
Which of the following is the correct syntax to create a materialized view named mv_customers selecting all columns from customers table?
ACREATE VIEW mv_customers AS SELECT * FROM customers;
BCREATE MATERIALIZED VIEW mv_customers AS SELECT * FROM customers;
CCREATE TABLE mv_customers AS SELECT * FROM customers;
DCREATE MATERIALIZED VIEW mv_customers SELECT * FROM customers;
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct syntax for materialized view creation

    The syntax requires 'CREATE MATERIALIZED VIEW view_name AS SELECT ...'.
  2. Step 2: Analyze options

    CREATE MATERIALIZED VIEW mv_customers AS SELECT * FROM customers; matches correct syntax; A creates a regular view; C creates a table; D misses 'AS' keyword.
  3. Final Answer:

    CREATE MATERIALIZED VIEW mv_customers AS SELECT * FROM customers; -> Option B
  4. Quick Check:

    Create materialized view syntax = CREATE MATERIALIZED VIEW ... AS SELECT [OK]
Quick Trick: Use 'AS' keyword when creating materialized views [OK]
Common Mistakes:
  • Omitting AS keyword
  • Confusing materialized view with regular view
  • Using CREATE TABLE instead

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes