Home Sql Mysql-example SQL get Column Name



SQL get Column Name
Posted on: January 23, 2009 at 12:00 AM
SQL get Column Name is used to return the Fieldnames of the table.

SQL get Column Name

     

SQL get Column Name is used to return the Fieldnames of the table.

Understand with Example

The Tutorial illustrate an example from 'SQL get Column Name'. To understand and elaborate example we create a table 'stu' with required fieldnames and datatypes respectively.

 

 

Create Table Stu:

Create Table Stu(Id int,Name Varchar(15));

Query:

The show columns is used to show fieldname and datatypes  from table 'Stu'.

SHOW COLUMNS FROM STU;

Result

+--------+-------------+------+-----+---------+-------+
| Field  | Type        | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+----




					---+
| Id     | varchar(2)  | YES  |     |         |       |
| Name   | varchar(15) | YES  |     |         |       |
| Class  | varchar(10) | YES  |     |         |       |
| sub_id | varchar(2)  | YES  |     |         |       |
| marks  | varchar(3)  | YES  |     |         |       |
+--------+-------------+------+-----+---------+-------+

Related Tags for SQL get Column Name:
sqlctablesedgetcolumnfieldnamereturntabietonamesldeusemesmeumnsurncolisdnssthababldnalumolo


More Tutorials from this section

Ask Questions?    Discuss: SQL get Column Name   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.