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 | | | | +--------+-------------+------+-----+---------+-------+ |
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.
Ask Questions? Discuss: SQL get Column Name View All Comments
Post your Comment