From the course: SQL Essential Training

Deleting views - SQL Tutorial

From the course: SQL Essential Training

Deleting views

- [Instructor] So we've looked at creating a view, we've looked at modifying a view. Now, let's take a look at deleting it. As you may have guessed, an easy way to do this is by going to our database structure and when we right-click, it was hard not to notice the last option here which is to delete a view. And this is one of the ways that we could actually simply delete a view. Now, I could hit delete view. We do get a confirmation message and we could just simply confirm that. I'm not going to do that just yet. I'm going to hit no for now. Take a note of our view, v average total. I'm going to head over to the execute SQL tab, and show you one more way that we could actually delete a view via SQL syntax. And that is the keyword, drop. And we want to specify that we are dropping a view, so we say, view. And next, we want to simply state the view name that we would like to drop. And we want to drop our V_Avg and there is IntelliSense saving us some typing. And I just select v average total. And now, if I simply run or execute this statement, we see that it has been executed without error. We head over to the database structure tab and we notice that our view is now removed. That v average total is no longer there. So these are the two ways that you could go about removing or deleting a view from within SQLite. And just one reminder, when you do remove your view, it is not affecting your tables. So the data that the view actually references all still there, the view itself is simply being removed.

Contents