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?
✗ Incorrect
CREATE VIEW defines a virtual table using a SELECT query.
Which keyword is used to define the columns shown in a VIEW?
✗ Incorrect
SELECT specifies the columns shown in a VIEW.
Can a VIEW contain data itself?
✗ Incorrect
A VIEW does not store data; it shows data from underlying tables.
How do you delete a VIEW named 'employee_view'?
✗ Incorrect
DROP VIEW is the correct command to remove a VIEW.
Which of these is a valid reason to use a VIEW?
✗ Incorrect
Views help simplify complex queries by encapsulating them.
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.