
- 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 to list temporary table columns in MySQL?
To list temporary table columns in MySQL, let us first create a temporary table.
Here’s an example. We have created a temporary table with some columns that includes the details of a student −
mysql> CREATE TEMPORARY TABLE DemoTable745 ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(100), StudentAge int, StudentAddress varchar(100), StudentCountryName varchar(20) ); Query OK, 0 rows affected (0.00 sec)
Following is the query to list temporary table columns in MySQL−
mysql> show columns from DemoTable745;
This will produce the following output -
+--------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------------+--------------+------+-----+---------+----------------+ | StudentId | int(11) | NO | PRI | NULL | auto_increment | | StudentName | varchar(100) | YES | | NULL | NULL | | StudentAge | int(11) | YES | | NULL | NULL | | StudentAddress | varchar(100) | YES | | NULL | NULL | | StudentCountryName | varchar(20) | YES | | NULL | NULL | +--------------------+--------------+------+-----+---------+----------------+ 5 rows in set (0.05 sec)
- Related Articles
- How can I delete MySQL temporary table?
- How do I list all the columns in a 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 get a list of columns in an existing MySQL table?
- Create a temporary table in a MySQL procedure?
- Create a temporary table with dates in MySQL
- How to create a temporary MySQL table in a SELECT statement without a separate CREATE TABLE?
- How to display MySQL Table Name with columns?
- Create a temporary table similar to a regular table with MySQL LIKE
- How to add columns to an existing MySQL table?
- How can we see MySQL temporary tables in the list of tables?
- How to get the datatype of MySQL table columns?
- How to check for duplicates in MySQL table over multiple columns?
- How to find the number of columns in a MySQL table?
- How to create conditions in a MySQL table with multiple columns?

Advertisements