MySQL Query to get the column names which are of a particular data type To accomplish this , you should be familiar with how the data types are declared in the information schema table of the DB. To know the Data type name just run this query on your PHP admin or MySql Client: SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'YOUR_DATABASE_NAME' AND TABLE_NAME = 'YOUR_TABLE_NAME' This will return the result like: COLUMN_NAME | DATA_TYPE ----------------------------- Field1 | int Field2 | int Field3 | varchar Field4 | text Field5 | longtext Field6 | float So we will be keep the above query as the base and will add condition " AND DATA_TYPE = 'DATA_TYPE_NAME' ". MySQL Query to get all fields in a table which are of Type INTEGER SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'YOUR_DATABASE_NAME' AND TABLE_NAME = 'YOUR_TABLE_NAME...
