Bird
0
0

A view is created as CREATE VIEW EmployeeNames AS SELECT first_name, last_name FROM Employees;. When you run INSERT INTO EmployeeNames VALUES ('John', 'Doe');, you get an error. Why?

medium📝 Debug Q7 of 15
SQL - Views
A view is created as CREATE VIEW EmployeeNames AS SELECT first_name, last_name FROM Employees;. When you run INSERT INTO EmployeeNames VALUES ('John', 'Doe');, you get an error. Why?
AViews cannot be used in SELECT statements
BViews do not store data and cannot be inserted into directly
CThe INSERT syntax is incorrect for views
DYou must specify all columns including hidden ones
Step-by-Step Solution
Solution:
  1. Step 1: Understand view behavior

    Views are virtual tables that do not store data physically.
  2. Step 2: Explain why INSERT fails

    Since views do not hold data, inserting directly into them is not allowed unless they are updatable views with specific rules.
  3. Final Answer:

    Views do not store data and cannot be inserted into directly -> Option B
  4. Quick Check:

    Views are virtual; direct inserts usually fail [OK]
Quick Trick: You cannot insert data directly into most views [OK]
Common Mistakes:
MISTAKES
  • Thinking views behave exactly like tables
  • Assuming INSERT syntax differs for views
  • Ignoring that views are virtual

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes