
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can we list all the columns of a MySQL view as we can list the columns of a MySQL table?
As we know that views are a type of virtual tables and are the composition of tables too hence we can use the same query to list all the columns of a MySQL view as we can list the columns of a MySQL table. In other words, we can use SHOW FULL COLUMNS statement to get the structure of a MySQL view. Its syntax would be as follows −
Syntax
SHOW FULL COLUMNS FROM View_name;
Here view_name is the name of the view from which we want to get the list of columns.
Example
Suppose if we want to get a list of columns of a 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)
- Related Articles
- How can we get a list of columns in an existing MySQL table?
- How can we get the structure of a MySQL view as we can get the structure of a MySQL table?
- How can we get the definition of a MySQL view as we can get the definition of a MySQL table?
- How can we add values into the columns of a MySQL table?
- How can we fetch one or more columns as output from a MySQL table?
- How can we set PRIMARY KEY on multiple columns of a MySQL table?
- How can we update any value in MySQL view as we can update the values in MySQL table?
- How do I list all the columns in a MySQL table?
- How can we combine the values of two or more columns of MySQL table?
- Can we alter order of columns in MySQL?
- How can I get the list of columns from a table in the database we are currently using?
- How can we alter table to add MySQL virtual GENERATED COLUMNS?
- How can we alter table to add MySQL stored GENERATED COLUMNS?
- How we can get more information about columns of a table than the\ninformation we got by DESCRIBE, EXPLAIN and SHOW COLUMNS MySQL statements?
- How can we fetch a MySQL SET column as a list of integer offset?

Advertisements