Bird
0
0

You try to create a view with this SQL:

medium📝 Debug Q6 of 15
SQL - Views
You try to create a view with this SQL:

CREATE VIEW RecentOrders AS SELECT order_id, order_date FROM Orders WHERE order_date > '2023-01-01'

But you get a syntax error. What is the likely cause?
AUsing a WHERE clause inside a view is not allowed
BMissing semicolon at the end of the statement
CThe date format is invalid in SQL
DCREATE VIEW requires parentheses around the SELECT
Step-by-Step Solution
Solution:
  1. Step 1: Check the syntax of CREATE VIEW

    CREATE VIEW statements must end with a semicolon to complete the command.
  2. Step 2: Verify other parts

    WHERE clauses are allowed, date format is valid, and parentheses are not required around SELECT.
  3. Final Answer:

    Missing semicolon at the end of the statement -> Option B
  4. Quick Check:

    Missing semicolon causes syntax error [OK]
Quick Trick: Always end SQL statements with semicolon [OK]
Common Mistakes:
MISTAKES
  • Assuming WHERE is not allowed in views
  • Thinking date format is wrong
  • Adding unnecessary parentheses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes