Using a SHOW statement in a subquery

You are viewing an old version of this question. View the current version here.

I want to write an SQL statement that returns ONLY the column names for a given table. "SHOW COLUMNS FROM `table_name`;" Shows the data I want (and more). In order to get the data I need, every column from this statement must be removed except the `Field` column.

I have tried using a subquery with SELECT, but keep getting a syntax error. "SELECT `Field` FROM (SHOW COLUMNS FROM `table_name`)" Any ideas how to accomplish this?


Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.