

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we get the structure of a MySQL view as we can get the structure of a MySQL table?
As we know that views are a type of virtual tables and are a composition of tables too hence we can use the same query to get the structure of a view which we use to get the structure of a table. In other words, we can use DESCRIBE statement to get the structure of a MySQL view. Its syntax would be as follows −
Syntax
DESCRIBE view_name;
Here, view_name is the name of the view of which we want to get the structure.
Example
Suppose we want to get the structure of a view named ‘Info’ then it can be done with the help, of the following query −
mysql> DESCRIBE INFO; +---------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------+-------------+------+-----+---------+-------+ | ID | int(11) | YES | | NULL | | | NAME | varchar(20) | YES | | NULL | | | SUBJECT | varchar(20) | YES | | NULL | | | ADDRESS | varchar(20) | YES | | NULL | | +---------+-------------+------+-----+---------+-------+ 4 rows in set (0.02 sec)
The above result set shows that all the fields got the same definitions as in the base table.
- Related Questions & Answers
- How can we get the definition of a MySQL view as we can get the definition of a MySQL table?
- How can we automatically define the structure of MySQL table same as the structure of another table?
- How can we list all the columns of a MySQL view as we can list the columns of a MySQL table?
- How can we update any value in MySQL view as we can update the values in MySQL table?
- How can we get the metadata of MySQL events?
- How can we change the name of a MySQL table?
- How can we get the sorted MySQL output?
- How can we get a list of columns in an existing MySQL table?
- In MySQL, how can we get the number code of a particular character?
- How can we drop a MySQL view from the database?
- How can we modify the definition of a MySQL view without dropping it?
- How can we get the list of MySQL server-side help categories?
- Can we get total number of rows in a MySQL database?
- How can we add values into the columns of a MySQL table?
- How can we get the metadata of triggers?
Advertisements