Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get field name types from a sql database

Tags:

mysql

To get field names one would use the command:

select column_name from information_schema.columns where table_name='person'; 

My question is how would one also get the field types in a similar list?

like image 299
Richard Avatar asked Jun 29 '10 15:06

Richard


1 Answers

SELECT
    column_name,
    column_type    # or data_type 
FROM information_schema.columns 
WHERE table_name='person'; 

Schema Info

like image 195
Ben S Avatar answered Nov 10 '22 22:11

Ben S