Bird
0
0

Consider this incorrect SQL statement to create a view:

medium📝 Debug Q14 of 15
SQL - Views
Consider this incorrect SQL statement to create a view:
CREATE VIEW SalesView SELECT OrderID, Amount FROM Sales;

What is the error and how to fix it?
AIncorrect view name; fix by renaming view
BMissing FROM keyword; fix by adding FROM before Sales
CSELECT statement is not allowed in views
DMissing AS keyword; fix by adding AS after view name
Step-by-Step Solution
Solution:
  1. Step 1: Identify the syntax error in CREATE VIEW

    The correct syntax requires AS keyword after the view name.
  2. Step 2: Correct the statement

    Add AS after SalesView: CREATE VIEW SalesView AS SELECT OrderID, Amount FROM Sales;
  3. Final Answer:

    Missing AS keyword; fix by adding AS after view name -> Option D
  4. Quick Check:

    CREATE VIEW ... AS SELECT ... [OK]
Quick Trick: Always use AS after view name in CREATE VIEW [OK]
Common Mistakes:
MISTAKES
  • Omitting AS keyword
  • Misplacing FROM keyword
  • Thinking SELECT is disallowed in views

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes