Test your PostgreSQL knowledge with multiple-choice questions on views, materialized views, SQL commands, refreshing, and catalog queries.
A. A physical copy of a table
B. A virtual table based on an SQL query
C. A database backup
D. A database index
A. MAKE VIEW
B. ADD VIEW
C. CREATE VIEW
D. NEW VIEW
A. GET VIEW
B. SELECT
C. SHOW VIEW
D. FETCH VIEW
A. Yes, always
B. No, it stores the query definition
C. It stores a backup
D. It stores indexes only
A. DELETE VIEW
B. REMOVE VIEW
C. DROP VIEW
D. TRUNCATE VIEW
A. UPDATE VIEW
B. CREATE OR REPLACE VIEW
C. ALTER TABLE
D. MODIFY VIEW
A. ALTER VIEW
B. UPDATE VIEW
C. RENAME TABLE
D. CHANGE VIEW
A. Yes
B. No
C. Only with INNER JOIN
D. Only with LEFT JOIN
A. pg_views
B. pg_tables
C. pg_indexes
D. pg_matviews
A. The regular View reflects the changes when queried
B. The View must always be recreated
C. The View is automatically deleted
D. The database must be restarted
A. A virtual table only
B. A stored result of an SQL query
C. A database user
D. A database trigger
A. CREATE VIEW
B. CREATE TABLE
C. CREATE MATERIALIZED VIEW
D. MAKE MATERIALIZED VIEW
A. UPDATE MATERIALIZED VIEW
B. REFRESH MATERIALIZED VIEW
C. ALTER MATERIALIZED VIEW
D. RELOAD VIEW
A. Yes, immediately
B. No, it requires refreshing
C. Only after restarting PostgreSQL
D. Only when an index exists
A. pg_tables
B. pg_indexes
C. pg_matviews
D. pg_database
ispopulated column in pg_matviews indicate?A. Whether the Materialized View has an index
B. Whether the Materialized View contains populated data
C. Whether the View has an owner
D. Whether the View has been renamed
A. WITH DATA
B. WITH NO DATA
C. WITHOUT INDEX
D. NO REFRESH
WITH NO DATA?A. Rename it
B. Create a primary key
C. Refresh it
D. Drop it
A. DROP VIEW
B. DROP MATERIALIZED VIEW
C. DELETE MATERIALIZED VIEW
D. TRUNCATE VIEW
A. Yes
B. No
C. Only a primary key
D. Only a foreign key
CREATE VIEW active_customers AS
SELECT *
FROM customer
WHERE active = true;
A. Creates a table named active_customers
B. Creates a View containing active customers
C. Deletes inactive customers
D. Updates the customer table
CREATE MATERIALIZED VIEW mv_payment_summary AS
SELECT
customer_id,
SUM(amount) AS total_payment
FROM payment
GROUP BY customer_id;
A. Creates a regular View
B. Creates a stored summary of customer payments
C. Deletes payment records
D. Creates an index on payment
REFRESH MATERIALIZED VIEW mv_payment_summary;
A. Deletes the Materialized View
B. Renames the Materialized View
C. Recalculates and updates its stored results
D. Creates a new table
A.
SELECT matviewname
FROM pg_matviews;
B.
SELECT viewname
FROM pg_views;
C.
SELECT tablename
FROM pg_tables;
D.
SELECT indexname
FROM pg_indexes;
A.
ALTER MATERIALIZED VIEW mv_old
RENAME TO mv_new;
B.
UPDATE MATERIALIZED VIEW mv_old;
C.
RENAME VIEW mv_old TO mv_new;
D.
CHANGE MATERIALIZED VIEW mv_old TO mv_new;
WITH DATA or WITH NO DATA?A. It is created without data
B. It is created and populated with data
C. It is created as a regular View
D. It generates an error
A. It always contains the latest data automatically
B. It can provide faster access to previously computed results
C. It eliminates the need for database tables
D. It prevents all data duplication
A. REFRESH MATERIALIZED VIEW CONCURRENTLY
B. UPDATE MATERIALIZED VIEW CONCURRENTLY
C. ALTER MATERIALIZED VIEW CONCURRENTLY
D. CREATE MATERIALIZED VIEW CONCURRENTLY
A. A foreign key B. A qualifying unique index covering all rows C. A trigger D. A primary key on every source table
A. Both always store query results physically
B. A regular View stores query results, while a Materialized View does not
C. A regular View stores a query definition, while a Materialized View stores query results
D. Both require manual refresh after data changes