SQL All Column Names

SQL All Column Names is useful when you want to see the Field, Type, Null, Key etc from the table records.

SQL All Column Names

SQL All Column Names

     

SQL All Column Names is useful when you want to see the Field, Type, Null, Key etc from the table records.

Understand with Example

The Tutorial briefs you on 'SQL All Column Names'. To understand and grasp the 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 Query below is used to show the Field, Type, Null etc of the 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  |     |         |       |
+--------+-------------+------+-----+---------+-------+