Bird
0
0

Which of the following is the correct way to create an updatable view on the employees table showing only id and email columns?

easy📝 Syntax Q3 of 15
PostgreSQL - Views and Materialized Views
Which of the following is the correct way to create an updatable view on the employees table showing only id and email columns?
ACREATE VIEW emp_email AS SELECT id, email FROM employees;
BCREATE VIEW emp_email AS SELECT id, email FROM employees WHERE email IS NOT NULL;
CCREATE VIEW emp_email AS SELECT id, email, salary FROM employees;
DCREATE VIEW emp_email AS SELECT id FROM employees;
Step-by-Step Solution
Solution:
  1. Step 1: Identify columns

    The view should include only id and email columns from employees.
  2. Step 2: Check syntax

    CREATE VIEW emp_email AS SELECT id, email FROM employees; correctly selects only id and email without filters or extra columns.
  3. Final Answer:

    CREATE VIEW emp_email AS SELECT id, email FROM employees; -> Option A
  4. Quick Check:

    Simple select with only required columns [OK]
Quick Trick: Select only needed columns without filters for updatable views [OK]
Common Mistakes:
  • Including extra columns makes view non-updatable
  • Adding WHERE clauses can restrict updates
  • Selecting only one column when more are needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes