SQL Data Definition Language (DDL): which statement is used to create a named view over one or more base tables?
Database
SQL for Database Construction
Difficulty: Easy
Choose an option
-
ACREATE VIEW
-
BMAKE VIEW
-
CSELECT VIEW
-
DINSERT VIEW
Answer
Correct Answer: CREATE VIEW
Explanation
Introduction / Context:A view is a saved SELECT definition that presents a virtual table. Knowing the correct DDL for creating a view is fundamental in SQL.
Given Data / Assumptions:
- Standard SQL syntax is assumed.
- We want the statement that defines (not queries) a view.
Concept / Approach:The DDL command for creating a view is CREATE VIEW view_name AS <select-statement>. Other verbs like MAKE, SELECT VIEW, or INSERT VIEW are not valid SQL commands.
Step-by-Step Solution:
Recall standard DDL verbs: CREATE, ALTER, DROP.Combine with the object type: VIEW.Therefore: CREATE VIEW.Verification / Alternative check:RDBMS documentation (PostgreSQL, SQL Server, Oracle, MySQL) consistently uses CREATE VIEW ... AS SELECT ...
Why Other Options Are Wrong:
- MAKE VIEW / SELECT VIEW / INSERT VIEW are not SQL DDL statements.
Common Pitfalls:Confusing the DDL (CREATE VIEW) with querying a view (SELECT ... FROM view_name).
Final Answer:CREATE VIEW