0
0
SQLquery~5 mins

CREATE VIEW syntax in SQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a VIEW in SQL?
A VIEW is a virtual table based on the result of a SQL query. It does not store data itself but shows data from one or more tables.
Click to reveal answer
beginner
Write the basic syntax to create a VIEW in SQL.
CREATE VIEW view_name AS SELECT column1, column2 FROM table_name WHERE condition;
Click to reveal answer
intermediate
Can you update data through a VIEW?
Sometimes yes, if the VIEW is simple and directly maps to one table without complex joins or aggregations. Otherwise, updates are not allowed.
Click to reveal answer
beginner
What happens if you try to SELECT from a VIEW?
The database runs the underlying query of the VIEW and returns the result as if it was a table.
Click to reveal answer
beginner
How do you remove a VIEW from the database?
Use the command: DROP VIEW view_name;
Click to reveal answer
What does the CREATE VIEW statement do?
AInserts data into a table
BDeletes a table from the database
CUpdates data in a table
DCreates a virtual table based on a SELECT query
Which keyword is used to define the columns shown in a VIEW?
AAS
BSELECT
CWHERE
DFROM
Can a VIEW contain data itself?
AYes, but only temporary data
BYes, it stores data permanently
CNo, it only shows data from tables
DOnly if created with INSERT
How do you delete a VIEW named 'employee_view'?
ADROP VIEW employee_view;
BDELETE VIEW employee_view;
CREMOVE VIEW employee_view;
DERASE VIEW employee_view;
Which of these is a valid reason to use a VIEW?
ATo simplify complex queries
BTo permanently store data
CTo speed up data insertion
DTo delete tables
Explain what a VIEW is and how to create one using SQL.
Think of a VIEW as a saved SELECT query that looks like a table.
You got /3 concepts.
    Describe how you can use a VIEW and how to remove it when no longer needed.
    Views are virtual tables you can query like real tables.
    You got /3 concepts.