1

I saw this post MySQL query to get column names? and I tried 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 e.g. id is possible have it?
Somehow is it possible to bypass qualitystandard?

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

Comments

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 = ?;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.