DROP VIEW
- SQL course
- Intermediate
- Lesson 74/115
- 4 min
Drop a view.
DROP VIEW
DROP VIEW removes a VIEW. Table data is not affected.
DROP VIEW active_customers;This query removes the VIEW.
DROP VIEW — details
DROP VIEW only deletes the definition. Underlying tables and data remain.
Instead of dropping and recreating a view to change it, you can also use CREATE OR REPLACE VIEW.
Practice DROP VIEW
Remove the active_customers VIEW with DROP VIEW.
Starter code
-- drop view
DROP VIEWSample solution
DROP VIEW active_customers;Expected output
VIEW kaldırıldı
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What does DROP VIEW delete?
- The view definition Correct answer
- The table
- The index
- The data
Explanation: DROP VIEW only deletes the VIEW definition.
2 Add DROP VIEW
DROP ____ active_customers;
DROP VIEW active_customers;
Explanation: DROP VIEW deletes only the view definition; the underlying table and data remain.
3 DROP VIEW: match the terms
| Term | Meaning |
|---|---|
DROP VIEW |
remove |
CREATE VIEW |
create |
SELECT |
query |
data |
unaffected |