Nisu
Nisu

Reputation: 307

Show column information for several columns

I can get needed information used the SHOW COLUMNS command for all columns or one column (with LIKE id='').
But how I can get the info for several columns, e.g remotely like SHOW [id, name, email, valid] COLUMNS FROM table?

Upvotes: 0

Views: 50

Answers (1)

jAC
jAC

Reputation: 5324

SELECT column_name, data_type 
FROM information_schema.columns 
WHERE table_name = 'MyTable' 
AND column_name IN ('Col1','Col2','Col3')

will give you the column name and its corresponding data type.

For more information, see the MySQL reference

Upvotes: 2

Related Questions