Understanding Views in MySQL and MS SQL
January 17th, 2012 by Anthony Curreri
What is a View?
A View looks and behaves just like a table, but it is generated. Most commonly, you create a view for a person or application to have access to a part of your database. You might simplify the data to just what people need to do adhoc queries, or you might provide an application the data it needs in a read-only view.
What’s in a View?
Would a view by any other name show the same data? It might, depending on the query that is used to dynamically construct the view. How do we see that query?
MySQL
SHOW CREATE VIEW databasename.viewname;
Microsoft SQL
EXEC sp_helptext ‘databasename.viewname’
If you found this helpful, help me by checking out the ads on the right. Thank you!
Link to this post! Copy and paste this code into your blog or website:
