How to find the name of a column in MySQL?

How do I get the name of a column? What's the query for this ?

Thanks.

Upvotes: 3

Views: 142

Answers (4)

Jude Cooray
Jude Cooray

Reputation: 19862

SHOW COLUMNS command can be used to retrieve column names in a table

http://dev.mysql.com/doc/refman/5.0/en/show-columns.html

Upvotes: 2

Ben Rowe
Ben Rowe

Reputation: 28711

That's a pretty broad context..

You could try something as simple as

describe `table_name`;

Upvotes: 0

Aishwar
Aishwar

Reputation: 9714

DESCRIBE tableName will give you the names of all the columns in the table.

Upvotes: 0

codaddict
codaddict

Reputation: 455030

You can use SHOW COLUMNS which displays information about the columns in a given table.

Upvotes: 0

Related Questions