David Grenier
David Grenier

Reputation: 1241

Do I need to explicitly DROP VIEW in mysql?

I've read the documentation on creating VIEWs in mysql, and I can't figure out if views are a temporary thing or if they are permanent. If I only want to use them for one session, do I need to manually add a DROP VIEW query to my PHP script, or do views get destroyed when the connection closes?

Upvotes: 1

Views: 791

Answers (2)

Jivings
Jivings

Reputation: 23250

Views are permanent until dropped. If you want a structure that is bound to the users session then perhaps you want temporary tables.

Temporary tables are only visible to the connection used to create them, and they disappear once the connection is closed.

Upvotes: 3

Mike B
Mike B

Reputation: 32155

Once created, views persist until dropped - Very much like normal tables. They are not dropped when the current connection session ends like temporary tables.

Upvotes: 3

Related Questions