SQLite DROP VIEW Keyword
The SQLite DROP VIEW statement is used to delete a SQLite VIEW. A SQLite VIEW is a virtual table created based on the SQLite statement. A view contains rows and columns just like a normal table. All SQLite functions, WHERE, HAVING and JOINs statements can be used to create a SQLite VIEW. Finally, to delete a SQLite VIEW, DROP VIEW keyword is used.
Syntax
The syntax for using DELETE VIEW statement in SQLite is given below:
DROP VIEW view_name;
Example:
Consider a database table called Employee with the following records:
EmpID | Name | City | Age | Salary |
---|---|---|---|---|
1 | John | London | 25 | 3000 |
2 | Marry | New York | 24 | 2750 |
3 | Jo | Paris | 27 | 2800 |
4 | Kim | Amsterdam | 30 | 3100 |
5 | Ramesh | New Delhi | 28 | 3000 |
6 | Huang | Beijing | 28 | 2800 |
The below mentioned SQLite statement is used to create a view on Employee table which contains all records of employee whose salary is greater than 2800.
CREATE VIEW Employee_Salary_GT_2800 AS SELECT * FROM Employee WHERE Salary > 2800;
After creating the VIEW, it can be used as mentioned below:
SELECT * FROM Employee_Salary_GT_2800;
This will produce the result as shown below:
EmpID | Name | City | Age | Salary |
---|---|---|---|---|
1 | John | London | 25 | 3000 |
4 | Kim | Amsterdam | 30 | 3100 |
5 | Ramesh | New Delhi | 28 | 3000 |
The DROP VIEW keyword is used to delete a view.
DROP VIEW Employee_Salary_GT_2800;
❮ SQLite Keywords