Bird
0
0

Which PostgreSQL command correctly creates a materialized view named mv_customers that selects all columns from the customers table?

easy📝 Syntax Q3 of 15
PostgreSQL - Views and Materialized Views
Which PostgreSQL command correctly creates a materialized view named mv_customers that selects all columns from the 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 TEMP VIEW mv_customers AS SELECT * FROM customers;
Step-by-Step Solution
Solution:
  1. Step 1: Identify the command for materialized view creation

    PostgreSQL uses CREATE MATERIALIZED VIEW to create materialized views.
  2. Step 2: Verify the syntax

    The syntax is CREATE MATERIALIZED VIEW view_name AS SELECT ....
  3. Final Answer:

    CREATE MATERIALIZED VIEW mv_customers AS SELECT * FROM customers; matches the correct syntax and purpose.
  4. Quick Check:

    Command uses CREATE MATERIALIZED VIEW and selects from customers [OK]
Quick Trick: Materialized views use CREATE MATERIALIZED VIEW [OK]
Common Mistakes:
  • Using CREATE VIEW instead of CREATE MATERIALIZED VIEW
  • Using CREATE TABLE which creates a table, not a view
  • Using TEMP VIEW which is temporary and not materialized

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes