How to use SHOW COLUMNS FROM Command to Get Column Names In MySQL
Another way to get the column names of a table, you use the SHOW COLUMNS FROM command in MySQL. DESCRIBE and these commands (both) return a result set with the columns. It is Similar to the DESCRIBE statement, which offers a quick way to display column information for a specified table.
Syntax:
SHOW COLUMNS FROM table_name;
Example
To get the column names of the `jobs` table using SHOW COLUMNS FROM, you can execute in the following way:
SHOW COLUMNS FROM jobs;
Output:
The output contains the same as the DESCRIBE Statement.
How to Get Column Names in MySQL?
To get column names in MySQL use techniques such as the DESCRIBE statement, INFORMATION_SCHEMA.COLUMNS, and SHOW COLUMNS FROM commands.
Here will cover these techniques, with explained examples, and help to get a better understanding on how to get column names in MySQL.