- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 I get the list of columns from a table in the other database than we are currently using?
It can be done with the SHOW COLUMNS statement. Its Syntax would be as follows −
Syntax
SHOW COLUMNS FROM db_name.tab_name
Here,
- tab_name is the name of the table from which we want to see the list of columns.
- Db_name is the name of the database, in which the table is stored
Example
In the example we are currently using the database ‘query’ and getting the list of columns from table named ‘arena’ stored in mysql ‘database’ −
mysql> SHOW COLUMNS FROM mysql.arena\G *************************** 1. row *************************** Field: id Type: int(10) unsigned zerofill Null: NO Key: PRI Default: NULL Extra: auto_increment *************************** 2. row *************************** Field: Photo Type: blob Null: YES Key: Default: NULL Extra: 2 rows in set (0.00 sec)
Advertisements