Kyokasuigetsu Kyokasuigetsu - 1 month ago 5
MySQL Question

How to select only fieldname when using show columns query in mysql

I use this query to select fields in a given table. Is it possible to select only the fieldname and not the whole structure of the table?

SHOW COLUMNS FROM student

Answer

You're trying to determine the table structure? You can query MySQL's information_schema database directly for the fieldnames:

select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='student';
Comments