SHOWFULLCOLUMNSFROMINFO"/> SHOWFULLCOLUMNSFROMINFO">
Home >Database >Mysql Tutorial >How can we list all the columns of a MySQL view like the columns of a MySQL table?
We know that a view is a virtual table and a combination of tables, so we can use the same query to list all columns of a MySQL view, just like we can Dequeuing is the same as for MySQL tables. In other words, we can use the SHOW FULL COLUMNS statement to get the structure of the MySQL view. Its syntax is as follows -
SHOW FULL COLUMNS FROM View_name;
Here view_name is the name of the view from which we want to get the column list.
Suppose we want to get the column list of the view named "Info" then it can be done with the help of the following query -
mysql> SHOW FULL COLUMNS FROM INFO\G *************************** 1. row *************************** Field: ID Type: int(11) Collation: NULL Null: YES Key: Default: NULL Extra: Privileges: select,insert,update,references Comment: *************************** 2. row *************************** Field: NAME Type: varchar(20) Collation: latin1_swedish_ci Null: YES Key: Default: NULL Extra: Privileges: select,insert,update,references Comment: *************************** 3. row *************************** Field: SUBJECT Type: varchar(20) Collation: latin1_swedish_ci Null: YES Key: Default: NULL Extra: Privileges: select,insert,update,references Comment: *************************** 4. row *************************** Field: ADDRESS Type: varchar(20) Collation: latin1_swedish_ci Null: YES Key: Default: NULL Extra: Privileges: select,insert,update,references Comment: 4 rows in set (0.00 sec)
The above is the detailed content of How can we list all the columns of a MySQL view like the columns of a MySQL table?. For more information, please follow other related articles on the PHP Chinese website!