1/* To retreive the column names of table using sql */
2
3SELECT COLUMN_NAME.
4FROM INFORMATION_SCHEMA. COLUMNS.
5WHERE TABLE_NAME = 'Your Table Name'
1-- MySQL
2SELECT *
3FROM INFORMATION_SCHEMA.COLUMNS;
4
5-- SQL Server (possible solution)
6SELECT *
7FROM SYS.COLUMNS;
8
9-- Oracle
10SELECT *
11FROM ALL_TAB_COLS; -- (If you only want user-defined columns)
12-- ALL_TAB_COLS : only user-defined columns
13-- ALL_TAB_COLUMNS : both user-defined AND system columns