
- 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 a list of columns in an existing MySQL table?
Suppose if we forgot the names of the columns in an existing table then we can use SHOW COLUMNS statement as follows to get the list of columns −
mysql> SHOW COLUMNS from Employee\G *************************** 1. row *************************** Field: Id Type: int(11) Null: YES Key: Default: NULL Extra: *************************** 2. row *************************** Field: Name Type: varchar(20) Null: YES Key: Default: NULL Extra: 2 rows in set (0.07 sec)
In the example above, we got the list of columns of ‘Employee’ table with the help of SHOW COLUMNS statement.
- Related Questions & Answers
- How can we get more details about columns of an existing table than return by MySQL SHOW COLUMNS statement?
- How can we set PRIMARY KEY on multiple columns of an existing MySQL 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 add columns with default values to an existing MySQL table?
- How can we add multiple columns, with single command, to an existing MySQL table?
- Do we have any other statement in MySQL instead of SHOW COLUMNS to get the list of columns in an existing table?
- How can we create a table from an existing MySQL table in the database?
- How can we remove composite PRIMARY KEY constraint applied on multiple columns of an existing MySQL table?
- How can we put comments in a column of existing MySQL table?
- How to add columns to an existing MySQL table?
- How can we remove PRIMARY KEY constraint from a column of an existing MySQL table?
- How can we remove FOREIGN KEY constraint from a column of an existing MySQL table?
- How can we remove NOT NULL constraint from a column of an existing MySQL table?
- How can we delete an existing MySQL table by using PHP script?
- How can we apply a NOT NULL constraint to a column of an existing MySQL table?
Advertisements