Posts

How to get list of views in a database in MySQL ?

 In SQL, a view is a virtual table based on the result-set of an SQL statement. A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database. Any operation performed on views is updated in real table as well. Here, we are going to discuss various methods of getting the list of all views that exist in a database. Method 1 (Using full table query) : Syntax :  use "your_db_name_here"; show full tables where table_type like "%VIEW"; This query can be used to get list of view in a database, once you have loaded that databases.  You can read more about it at https://dev.mysql.com/doc/refman/8.0/en/show-tables.html Method 2 (Using information_schema) : Syntax : select * from information_schema.views where table_schema = "your_db_name_here"; OR select table_schema,table_name,view_definition from information_schema.views where table_schema = "your_db_name_here"; This query can b
Recent posts