1

i saw this post MySQL query to get column names? i try to use this code `table name` or DESCRIBE `table name` or SHOW COLUMNS FROM `table name` but return me also a datatype and more in this mode

id  int NO auto_increment

i want only a name id is possible have it ?? thanks somtime is possible bypass qualitystandard ?? please

Jens
  • 63,364
  • 15
  • 92
  • 104

2 Answers2

1

use the tables from information_schema to get the meta data of your table:

SELECT COLUMN_NAME
  FROM INFORMATION_SCHEMA.COLUMNS
  WHERE table_name = 'tbl_name'

For more information see https://docs.oracle.com/cd/E19078-01/mysql/mysql-refman-5.0/information-schema.html#columns-table

Jens
  • 63,364
  • 15
  • 92
  • 104
1

If you don't like the default output of the SHOW commands, you can get anything you want from the INFORMATION_SCHEMA tables (which is where the SHOW commands get their data too).

SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?;
Bill Karwin
  • 499,602
  • 82
  • 638
  • 795